about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-11-25 09:15:20 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2014-11-25 09:15:20 -0800
commit05e919dc565dc6231f1c89d23d0264bcb98b29aa (patch)
tree32e5025739b825a305fe6a517a56106fe8e10667
parent1fec267156f86756275c2ff1faa97cdc975749e0 (diff)
downloadzsh-05e919dc565dc6231f1c89d23d0264bcb98b29aa.tar.gz
zsh-05e919dc565dc6231f1c89d23d0264bcb98b29aa.tar.xz
zsh-05e919dc565dc6231f1c89d23d0264bcb98b29aa.zip
33791: fatal errors in an "always" construct yield nonzero status
Fatal errors in the try-block part of an "always" construct cause the
entire construct to have nonzero status, even when TRY_BLOCK_ERROR is
used to suppress the error.
-rw-r--r--ChangeLog6
-rw-r--r--Src/loop.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4b5a0b8df..ad71ac8f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-25  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* 33791: Src/loop.c: fatal errors in the try-block part of an
+	"always" construct cause the entire construct to have nonzero
+	status, even when TRY_BLOCK_ERROR is used to suppress the error.
+
 2014-11-24  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* Daniel Hahler: 33746: Doc/Zsh/builtins.yo: read -q refers to -t.
diff --git a/Src/loop.c b/Src/loop.c
index 2f639fd5a..82d2fe31a 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -659,8 +659,9 @@ exectry(Estate state, int do_exec)
 
     try_tryflag = save_try_tryflag;
 
-    /* Don't record errflag here, may be reset. */
-    endval = lastval;
+    /* Don't record errflag here, may be reset.  However, */
+    /* endval should show failure when there is an error. */
+    endval = lastval ? lastval : errflag;
 
     freeheap();