about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <danielsh@apache.org>2020-01-15 18:02:33 +0000
committerDaniel Shahaf <danielsh@apache.org>2020-01-16 18:29:13 +0000
commit7ca2b06501b463641426d009a54b21b89b8ca9ee (patch)
tree2ab6553294aeddb16030f1199f3da8a73ba425f7
parentfb3865514ce52de5b1b2cfa34899a133e76edf78 (diff)
downloadzsh-7ca2b06501b463641426d009a54b21b89b8ca9ee.tar.gz
zsh-7ca2b06501b463641426d009a54b21b89b8ca9ee.tar.xz
zsh-7ca2b06501b463641426d009a54b21b89b8ca9ee.zip
45304: Do execute the always block even when the try/always block itself is the last command.
Fixes the test added in the previous commit (workers/45305).
-rw-r--r--ChangeLog5
-rw-r--r--Src/loop.c2
-rw-r--r--Test/A01grammar.ztst2
3 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 643352dfe..675342647 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-16  Daniel Shahaf  <danielsh@apache.org>
+
+	* 45304: Src/loop.c, Test/A01grammar.ztst: Do execute the always
+	block even when the try/always block itself is the last command.
+
 2020-01-15  dana  <dana@dana.is>
 
 	* 45292: Test/D02glob.ztst: Add regression test for macOS stat(2)
diff --git a/Src/loop.c b/Src/loop.c
index 538afb8dc..57858a150 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -742,7 +742,7 @@ exectry(Estate state, int do_exec)
 
     /* The :try clause */
     ++try_tryflag;
-    execlist(state, 1, do_exec);
+    execlist(state, 1, 0);
     --try_tryflag;
 
     /* Don't record errflag here, may be reset.  However, */
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 1e0e9a04e..0dbf468f6 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -930,5 +930,5 @@ F:Note that the behaviour of 'exit' inside try-list inside a function is unspeci
 >or false
 
  $ZTST_testdir/../Src/zsh -fc '{ ( ) } always { echo foo }'
--f:exec last command optimization inhibited for try/always
+0:exec last command optimization inhibited for try/always
 >foo