mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-11-30 03:50:56 +01:00
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.
This commit is contained in:
parent
f96a016728
commit
ab74c86edb
4 changed files with 77 additions and 9 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue