about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2021-05-15 13:59:17 -0700
committerBart Schaefer <schaefer@ipost.com>2021-05-15 13:59:17 -0700
commitdb3614900602b51edd79ae8c1308b8665de9f913 (patch)
tree0cdc7c8235fb7edb289bc651f28d29171c3d68a2 /Src
parente4bd6dc8182d7aa1c28058450db08e0a4dd41e90 (diff)
downloadzsh-db3614900602b51edd79ae8c1308b8665de9f913.tar.gz
zsh-db3614900602b51edd79ae8c1308b8665de9f913.tar.xz
zsh-db3614900602b51edd79ae8c1308b8665de9f913.zip
users/26742: break out of surrounding shell loops when exit is called from an exit hook
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index b7ceefd55..a29eb49e4 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -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           */