Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

'exit' in trap handler does not execute EXIT trap



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