Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
'exit' in trap handler does not execute EXIT trap
- X-seq: zsh-workers 39859
- From: Martijn Dekker <martijn@xxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: 'exit' in trap handler does not execute EXIT trap
- Date: Mon, 7 Nov 2016 18:18:47 +0000
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
zsh does not execute the EXIT trap if the trap handler for another trap
exits the shell. I cannot find anything about this in the POSIX spec,
but this is different from all the other shells, which do execute the
EXIT trap.
Test script:
trap 'echo TERM; exit' TERM
trap 'echo EXIT' EXIT
kill -s TERM "$$"
echo 'FATAL: we should never get here!' 1>&2
exit 1
Actual output: TERM
Expected output: TERM\nEXIT
Thanks,
- M.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author