zsh-workers
 help / color / mirror / code / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: EXIT trap not executed on error
Date: Sat, 8 Dec 2018 21:08:45 +0100	[thread overview]
Message-ID: <1939278e-89c4-812d-5dea-e836568dc100@inlv.org> (raw)

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.

             reply	other threads:[~2018-12-08 20:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-08 20:08 Martijn Dekker [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1939278e-89c4-812d-5dea-e836568dc100@inlv.org \
    --to=martijn@inlv.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).