diff options
author | Peter Stephenson <pws@zsh.org> | 2016-02-25 14:20:26 +0000 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2016-02-25 14:20:26 +0000 |
commit | c55d8551718bcf2fc7661c31c13e934060a5f1a7 (patch) | |
tree | ea5362983b67d3c471e54beae6495d928d81eb21 /Test/C03traps.ztst | |
parent | 3195003cde3287300b75903f5266721bd04e0e31 (diff) | |
download | zsh-c55d8551718bcf2fc7661c31c13e934060a5f1a7.tar.gz zsh-c55d8551718bcf2fc7661c31c13e934060a5f1a7.tar.xz zsh-c55d8551718bcf2fc7661c31c13e934060a5f1a7.zip |
38024: Improve POSIX and native EXIT traps compatibility.
Allow a nested function trap to leave save and restore a POSIX trap. Still fails if the POSIX trap was defined in a function.
Diffstat (limited to 'Test/C03traps.ztst')
-rw-r--r-- | Test/C03traps.ztst | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst index d8183a428..f4466b556 100644 --- a/Test/C03traps.ztst +++ b/Test/C03traps.ztst @@ -419,6 +419,23 @@ >end of program >EXIT TRAP TRIGGERED + (cd ..; $ZTST_exe -fc ' + echo entering program + emulate sh -c '\''trap "echo POSIX exit trap triggered" EXIT'\'' + fn() { + trap "echo native zsh function-local exit trap triggered" EXIT + echo entering native zsh function + } + fn + echo exiting program + ') +0:POSX EXIT trap can have nested native mode EXIT trap +>entering program +>entering native zsh function +>native zsh function-local exit trap triggered +>exiting program +>POSIX exit trap triggered + (set -e printf "a\nb\n" | while read line do |