From c55d8551718bcf2fc7661c31c13e934060a5f1a7 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 25 Feb 2016 14:20:26 +0000 Subject: 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. --- Test/C03traps.ztst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Test') 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 -- cgit 1.4.1