summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2016-11-10 10:37:27 +0000
committerPeter Stephenson <pws@zsh.org>2016-11-10 10:37:27 +0000
commit5f1700755f12677b608adef88c39e08df99c41f2 (patch)
treec194e75d628380726e2649df40b70d41c6377beb /Test
parent370b278565126a0abf3382ba10965e7a1090e7f8 (diff)
downloadzsh-5f1700755f12677b608adef88c39e08df99c41f2.tar.gz
zsh-5f1700755f12677b608adef88c39e08df99c41f2.tar.xz
zsh-5f1700755f12677b608adef88c39e08df99c41f2.zip
39901: No EXIT trap on LHS of pipeline.
There is a special case if the LHS is a shell construct.
Add unit tests for both cases.
Diffstat (limited to 'Test')
-rw-r--r--Test/C03traps.ztst17
1 files changed, 17 insertions, 0 deletions
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index 828a3d10f..c3bedb06c 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -641,6 +641,23 @@ F:Must be tested with a top-level script rather than source or function
 >TERM
 >EXIT
 
+  # Should not get "hello" in the single quotes.
+  (
+    trap "echo hello" EXIT;
+    { :; } | { read line; print "'$line'"; }
+  )
+0:EXIT trap not called in LHS of pipeline: Shell construct on LHS
+>''
+>hello
+
+  (
+    trap "echo hello" EXIT;
+    cat </dev/null | { read line; print "'$line'"; }
+  )
+0:EXIT trap not called in LHS of pipeline: External command on LHS
+>''
+>hello
+
 %clean
 
   rm -f TRAPEXIT