about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-06-27 11:22:04 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-06-27 11:22:04 +0000
commitb275190ff41ce261d9ec8bf6d984191252a1320f (patch)
tree5a759ec5c9ff88d4bab610f055db43642311b80b /Src/exec.c
parentb053d02cdb782f02e85b540b3fc0e2a70faa5695 (diff)
downloadzsh-b275190ff41ce261d9ec8bf6d984191252a1320f.tar.gz
zsh-b275190ff41ce261d9ec8bf6d984191252a1320f.tar.xz
zsh-b275190ff41ce261d9ec8bf6d984191252a1320f.zip
add autocontinue option to automatically make stopped jos running when they are being disowned; make that the default for `%job &!' and `%job &|' (15115)
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 625c376b7..91ce74e57 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1645,7 +1645,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
     int nullexec = 0, assign = 0, forked = 0;
     int is_shfunc = 0, is_builtin = 0, is_exec = 0;
     /* Various flags to the command. */
-    int cflags = 0, checked = 0;
+    int cflags = 0, checked = 0, oautocont = opts[AUTOCONTINUE];
     LinkList redir;
     wordcode code;
     Wordcode beg = state->pc, varspc;
@@ -1680,6 +1680,8 @@ execcmd(Estate state, int input, int output, int how, int last1)
      * reference to a job in the job table.                */
     if (type == WC_SIMPLE && args && nonempty(args) &&
 	*(char *)peekfirst(args) == '%') {
+        if (how & Z_DISOWN)
+            opts[AUTOCONTINUE] = 1;
 	pushnode(args, dupstring((how & Z_DISOWN)
 				 ? "disown" : (how & Z_ASYNC) ? "bg" : "fg"));
 	how = Z_SYNC;
@@ -1833,6 +1835,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 		if (cflags & BINF_BUILTIN) {
 		    zwarn("no such builtin: %s", cmdarg, 0);
 		    lastval = 1;
+                    opts[AUTOCONTINUE] = oautocont;
 		    return;
 		}
 		break;
@@ -1856,6 +1859,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 
     if (errflag) {
 	lastval = 1;
+        opts[AUTOCONTINUE] = oautocont;
 	return;
     }
 
@@ -1899,6 +1903,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 
     if (errflag) {
 	lastval = 1;
+        opts[AUTOCONTINUE] = oautocont;
 	return;
     }
 
@@ -1981,6 +1986,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 	if ((pid = zfork()) == -1) {
 	    close(synch[0]);
 	    close(synch[1]);
+            opts[AUTOCONTINUE] = oautocont;
 	    return;
 	} if (pid) {
 	    close(synch[1]);
@@ -2006,6 +2012,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 		}
 	    }
 	    addproc(pid, text);
+            opts[AUTOCONTINUE] = oautocont;
 	    return;
 	}
 	/* pid == 0 */
@@ -2373,6 +2380,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 
     zsfree(STTYval);
     STTYval = 0;
+    opts[AUTOCONTINUE] = oautocont;
 }
 
 /* Arrange to have variables restored. */