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

Re: EXIT trap not executed on error



On Wed, Dec 14, 2022 at 12:35 AM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>
> I had a look at the errflag logic and admittedly I don't understand everything/much. However I noticed that other places that restore the errflag preserve the ERRFLAG_INT bit.

IMO that's irrelevant ... no trap will run when errflag is set, and in
theory at least the exit trap is the last thing we're going to do, so
remembering that we got an interrupt during the trap doesn't mean
much.  zexit() actually goes so far as to clear errflag twice and to
clear intrap as well the second time.  I'm actually pretty sure saving
and restoring errflag is not needed at all.

> I also wondered whether signals.c/dotraps would be a better place for the new logic.

I considered that, but saw dotraps being re-entered while stepping
through things with the debugger, so I thought it better to stay with
doing changes in the caller.




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