help / Atom feed
* EXIT trap not executed on error
@ 2018-12-08 20:08 Martijn Dekker
  0 siblings, 0 replies; 1+ 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] 1+ messages in thread

only message in thread, back to index

Thread overview: (only message) (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


Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/ public-inbox