1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-21 03:12:01 +02:00

users/26742: break out of surrounding shell loops when exit is called from an exit hook

This commit is contained in:
Peter Stephenson 2021-05-15 13:59:17 -07:00 committed by Bart Schaefer
parent e4bd6dc818
commit db36149006
2 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2021-05-15 Bart Schaefer <schaefer@zsh.org>
* Peter Stephenson: users/26742: Src/builtin.c: break out of
surrounding shell loops when "exit" is called from an exit hook
* users/26736: Src/Zle/zle_main.c: avoid infinite loop in getbyte
when read -q is called from exit hook

View File

@ -5828,8 +5828,11 @@ zexit(int val, enum zexit_t from_where)
* a later value always overrides an earlier.
*/
exit_val = val;
if (shell_exiting == -1)
if (shell_exiting == -1) {
retflag = 1;
breaks = loops;
return;
}
if (isset(MONITOR) && !stopmsg && from_where != ZEXIT_SIGNAL) {
scanjobs(); /* check if jobs need printing */