mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-05-20 23:41:27 +02:00
51210: Clear errflag before calling EXIT trap
If this is not done, special cases such as failures in special builtins or errors in math expressions skip the trap execution.
This commit is contained in:
parent
727079f7e5
commit
6d49734d46
2 changed files with 7 additions and 0 deletions
|
@ -1,5 +1,8 @@
|
|||
2022-12-13 Bart Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 51210: Src/exec.c: Clear errflag before calling EXIT trap,
|
||||
otherwise the trap is skipped for special-case errors in builtins
|
||||
|
||||
* Philippe Altherr: 51198: Doc/Zsh/options.yo: Clarify and expand
|
||||
ERR_EXIT and ERR_RETURN documentation to include updated behavior
|
||||
|
||||
|
|
|
@ -1598,6 +1598,7 @@ sublist_done:
|
|||
(isset(ERRRETURN) && !errreturn)) &&
|
||||
!(noerrexit & NOERREXIT_EXIT);
|
||||
if (errexit) {
|
||||
errflag = 0;
|
||||
if (sigtrapped[SIGEXIT])
|
||||
dotrap(SIGEXIT);
|
||||
if (mypid != getpid())
|
||||
|
@ -1630,9 +1631,12 @@ sublist_done:
|
|||
thisjob = cj;
|
||||
|
||||
if (exiting && sigtrapped[SIGEXIT]) {
|
||||
int eflag = errflag;
|
||||
errflag = 0; /* Clear the context for trap */
|
||||
dotrap(SIGEXIT);
|
||||
/* Make sure this doesn't get executed again. */
|
||||
sigtrapped[SIGEXIT] = 0;
|
||||
errflag = eflag;
|
||||
}
|
||||
|
||||
unqueue_signals();
|
||||
|
|
Loading…
Reference in a new issue