summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_main.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a1a4a0850..58ed68801 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-23  Bart Schaefer  <schaefer@zsh.org>
+
+	* unposted: Src/Zle/zle_main.c: clear ERRFLAG_ERROR before
+	invoking immortal widget (cf. 39934)
+
 2016-11-23  Oliver Kiddle  <opk@zsh.org>
 
 	* unposted: Test/Y03arguments.ztst: partial match test case
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 938dc0e29..15ea79643 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1498,8 +1498,12 @@ execzlefunc(Thingy func, char **args, int set_bindk)
 	    opts[XTRACE] = oxt;
 	    sfcontext = osc;
 	    endparamscope();
-	    if (errflag == ERRFLAG_ERROR && !(ret = execimmortal(func, args)))
+	    if (errflag == ERRFLAG_ERROR) {
+		int saverr = errflag;
 		errflag &= ~ERRFLAG_ERROR;
+		if ((ret = execimmortal(func, args)) != 0)
+		    errflag |= saverr;
+	    }
 	    lastcmd = w->flags & ~(WIDGET_INUSE|WIDGET_FREE);
 	    if (inuse) {
 		w->flags &= WIDGET_INUSE|WIDGET_FREE;