help / color / mirror / code / Atom feed
* Interrupts and "always" blocks, and another unexpected exception
@ 2022-05-31 22:55 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2022-05-31 22:55 UTC (permalink / raw)
  To: Zsh hackers list

I was afraid this was a regression in 5.9, but 5.3 has the same
behavior, and in fact so does 4.3.12 (the oldest I can conveniently

% { sleep 10; } always { print -u2 STATUS: $? }
% ({ sleep 10; } always { print -u2 STATUS: $? })

Note that the always block fails to execute inside the subshell.  If
an interrupt doesn't qualify as an "error condition" in the subshell,
shouldn't that also be true at the top level?  (I am concerned that
changing that could break a lot of zle widgets.)

Another case:

% { set -e ; false } always { print -u2 done }

So errexit isn't an "error condition" either?

The doc does mention that exit or return "outside of any function"
bypasses the always block, but wrapping either of the above in a
function doesn't change their behavior.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-31 22:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31 22:55 Interrupts and "always" blocks, and another unexpected exception Bart Schaefer

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


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).