about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2016-09-25 19:18:43 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2016-09-25 19:18:43 +0100
commite35dcae40fca1baebc202561040f5c6eec421613 (patch)
tree1251e56fed82a019e7e1ba6e72e53ae74627e65e
parent759e5912fdb783e70b3e0d50fa0bc63e441a848b (diff)
downloadzsh-e35dcae40fca1baebc202561040f5c6eec421613.tar.gz
zsh-e35dcae40fca1baebc202561040f5c6eec421613.tar.xz
zsh-e35dcae40fca1baebc202561040f5c6eec421613.zip
39436: Pass on status of SIGINT better.
Set lastval to 128 + SIGINT on interrupt.

Don't execute builtin if already interrupted at that point.
-rw-r--r--ChangeLog3
-rw-r--r--Src/exec.c3
-rw-r--r--Src/signals.c1
3 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 967c63170..f2404aeba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2016-09-25  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* 39436: Src/exec.c, Src/signals.c: Don't execute builtin if
+	interrupted; set lastval to 128 + SIGINT on interrupt.
+
 	* 39435: Src/exec.c: Don't set gleader of SUBJOB immediately if
 	SUPERJOB has no processes.
 
diff --git a/Src/exec.c b/Src/exec.c
index a5086c33c..4e8934061 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3701,7 +3701,8 @@ execcmd(Estate state, int input, int output, int how, int last1)
 		    state->pc = opc;
 		}
 		dont_queue_signals();
-		lastval = execbuiltin(args, assigns, (Builtin) hn);
+		if (!errflag)
+		    lastval = execbuiltin(args, assigns, (Builtin) hn);
 		if (do_save & BINF_COMMAND)
 		    errflag &= ~ERRFLAG_ERROR;
 		restore_queue_signals(q);
diff --git a/Src/signals.c b/Src/signals.c
index 30dde713f..e2587dc72 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -646,6 +646,7 @@ zhandler(int sig)
 		inerrflush();
 		check_cursh_sig(SIGINT);
             }
+	    lastval = 128 + SIGINT;
         }
         break;