about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-12-27 21:55:58 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2014-12-27 21:55:58 -0800
commitd6a32ddeed914434f5b56b013c9d03b28781d065 (patch)
tree050eb544d08c31b8ad2d443a7563bf68b6b72355 /Src/exec.c
parent89c692eafb78d4f5a7cf48dc8fc8ab3e5eb73abd (diff)
downloadzsh-d6a32ddeed914434f5b56b013c9d03b28781d065.tar.gz
zsh-d6a32ddeed914434f5b56b013c9d03b28781d065.tar.xz
zsh-d6a32ddeed914434f5b56b013c9d03b28781d065.zip
34065: following an "if" condition, do not test lastval for ERR_EXIT until a new command is run
Includes unposted regression tests.
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 6a7dbb1e1..eaf73df25 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2632,6 +2632,10 @@ execcmd(Estate state, int input, int output, int how, int last1)
 	}
     }
 
+    /* if we get this far, it is OK to pay attention to lastval again */
+    if (noerrexit == 2 && !is_shfunc)
+	noerrexit = 0;
+
     /* Do prefork substitutions */
     esprefork = (assign || isset(MAGICEQUALSUBST)) ? PREFORK_TYPESET : 0;
     if (args && htok)