mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-27 16:50:58 +01:00
* Src/builtin.c, Src/exec.c: Unwind function calls before exiting
shell from exit command to allow EXIT traps to run.
This commit is contained in:
parent
cd59ad72b6
commit
11b0734108
3 changed files with 50 additions and 9 deletions
16
Src/exec.c
16
Src/exec.c
|
|
@ -3429,6 +3429,22 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
|
|||
if (noreturnval)
|
||||
lastval = oldlastval;
|
||||
popheap();
|
||||
|
||||
if (exit_pending) {
|
||||
if (locallevel) {
|
||||
/* Still functions to return: force them to do so. */
|
||||
retflag = 1;
|
||||
breaks = loops;
|
||||
} else {
|
||||
/*
|
||||
* All functions finished: time to exit the shell.
|
||||
* We already did the `stopmsg' test when the
|
||||
* exit command was handled.
|
||||
*/
|
||||
stopmsg = 1;
|
||||
zexit(exit_pending >> 1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* This finally executes a shell function and any function wrappers *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue