summaryrefslogtreecommitdiff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2016-02-17 10:40:55 +0000
committerPeter Stephenson <pws@zsh.org>2016-02-17 10:40:55 +0000
commitab74c86edb30fa04fda5fe7fa01e404334f7c2b0 (patch)
tree096002145a76bca90e09c2dc511008f33145acc2 /Test
parentf96a0167289d41d583b01b17482bba0641be2805 (diff)
downloadzsh-ab74c86edb30fa04fda5fe7fa01e404334f7c2b0.tar.gz
zsh-ab74c86edb30fa04fda5fe7fa01e404334f7c2b0.zip
37999: Sticky behaviour of EXIT traps.
They now have POSIX or non-POSIX behaviour based on the setting of POSIX_TRAPS where the trap was defined, rather than where the trap would (or would not) be executed. Tweaks possible.
Diffstat (limited to 'Test')
-rw-r--r--Test/C03traps.ztst20
1 files changed, 20 insertions, 0 deletions
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index 4b2843a47..d8183a428 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -399,6 +399,26 @@
>}
>No, really exited
+ (cd ..; $ZTST_exe -fc 'unsetopt posixtraps;
+ echo start program
+ emulate sh -c '\''testfn() {
+ echo start function
+ set -o | grep posixtraps
+ trap "echo EXIT TRAP TRIGGERED" EXIT
+ echo end function
+ }'\''
+ testfn
+ echo program continuing
+ echo end of program')
+0:POSIX_TRAPS effect on EXIT trap is sticky
+>start program
+>start function
+>noposixtraps off
+>end function
+>program continuing
+>end of program
+>EXIT TRAP TRIGGERED
+
(set -e
printf "a\nb\n" | while read line
do