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

EXIT trap not executed on error



When zsh exits due to an error in a special builtin (e.g. 'set -o bad@option') or in an arithmetic expression in $((...)), the EXIT trap is not executed.

Is this a bug? I'm not sure -- I can't find anything relevant in the POSIX spec. But it seems to me like the trap should be executed. All the other shells execute the trap.

Emulation modes don't seem to make a difference to this behaviour.

$ zsh -c 'trap "echo OK" EXIT; : $((1\\2)); echo OOPS'
zsh:1: bad math expression: illegal character: \

(output I would expect: that error message followed by 'OK')

- M.



Messages sorted by: Reverse Date, Date, Thread, Author