about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2016-10-10 10:55:48 +0100
committerPeter Stephenson <pws@zsh.org>2016-10-10 10:55:48 +0100
commit8f2ce89a0c80f6a0ecdc7c1189d6a94f620882f4 (patch)
treefc1e0bdd5889edc5035d5a8f974a5cf6c5af7089
parentb4cc190db9a8419ca8c5a39ae45c95cb9db0ff84 (diff)
downloadzsh-8f2ce89a0c80f6a0ecdc7c1189d6a94f620882f4.tar.gz
zsh-8f2ce89a0c80f6a0ecdc7c1189d6a94f620882f4.tar.xz
zsh-8f2ce89a0c80f6a0ecdc7c1189d6a94f620882f4.zip
39599: Don't reset status before "case" execution
-rw-r--r--ChangeLog5
-rw-r--r--Src/loop.c1
-rw-r--r--Test/A01grammar.ztst8
3 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a1699ac24..0f41c18fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-10  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 39599: Src/loop.c, Test/A01grammar.ztst: Don't reset status
+	before "case" execution.
+
 2016-10-07  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* 39522: Doc/Zsh/contrib.yo: add-zsh-hook/add-zle-hook-widget:
diff --git a/Src/loop.c b/Src/loop.c
index 3b9d02144..94b61b7ed 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -592,7 +592,6 @@ execcase(Estate state, int do_exec)
     word = ecgetstr(state, EC_DUP, NULL);
     singsub(&word);
     untokenize(word);
-    lastval = 0;
 
     cmdpush(CS_CASE);
     while (state->pc < end) {
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 0b1085c3e..0e77f3ebc 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -757,6 +757,14 @@
 >}
 >Stuff here
 
+  (exit 37)
+  case $? in
+    (37) echo $?
+    ;;
+  esac
+0:case retains exit status for execution of cases
+>37
+
   x=1
   x=2 | echo $x
   echo $x