zsh-workers
 help / color / mirror / code / Atom feed
* EXIT trap not executed on error
@ 2018-12-08 20:08 Martijn Dekker
  2022-12-12  4:52 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Martijn Dekker @ 2018-12-08 20:08 UTC (permalink / raw)
  To: Zsh hackers list

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-15  6:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-08 20:08 EXIT trap not executed on error Martijn Dekker
2022-12-12  4:52 ` Bart Schaefer
2022-12-14  4:47   ` Bart Schaefer
2022-12-14  8:35     ` Philippe Altherr
2022-12-15  6:40       ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).