diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-06-27 11:22:04 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-06-27 11:22:04 +0000 |
commit | b275190ff41ce261d9ec8bf6d984191252a1320f (patch) | |
tree | 5a759ec5c9ff88d4bab610f055db43642311b80b /Src/jobs.c | |
parent | b053d02cdb782f02e85b540b3fc0e2a70faa5695 (diff) | |
download | zsh-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/jobs.c')
-rw-r--r-- | Src/jobs.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Src/jobs.c b/Src/jobs.c index 50002d28f..f462a0ae8 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -1215,7 +1215,7 @@ init_hackzero(char **argv, char **envp) int bin_fg(char *name, char **argv, char *ops, int func) { - int job, lng, firstjob = -1, retval = 0; + int job, lng, firstjob = -1, retval = 0, ofunc = func; if (ops['Z']) { int len; @@ -1299,6 +1299,8 @@ bin_fg(char *name, char **argv, char *ops, int func) for (; (firstjob != -1) || *argv; (void)(*argv && argv++)) { int stopped, ocj = thisjob; + func = ofunc; + if (func == BIN_WAIT && isanum(*argv)) { /* wait can take a pid; the others can't. */ pid_t pid = (long)atoi(*argv); @@ -1326,6 +1328,13 @@ bin_fg(char *name, char **argv, char *ops, int func) unqueue_signals(); return 1; } + /* If AUTO_CONTINUE is set (automatically make stopped jobs running + * on disown), we actually do a bg and then delete the job table entry. */ + + if (isset(AUTOCONTINUE) && func == BIN_DISOWN && + jobtab[job].stat & STAT_STOPPED) + func = BIN_BG; + /* We have a job number. Now decide what to do with it. */ switch (func) { case BIN_FG: @@ -1386,7 +1395,8 @@ bin_fg(char *name, char **argv, char *ops, int func) if (func != BIN_BG) { waitjobs(); retval = lastval2; - } + } else if (ofunc == BIN_DISOWN) + deletejob(jobtab + job); break; case BIN_JOBS: printjob(job + jobtab, lng, 2); |