diff options
author | Peter Stephenson <pws@zsh.org> | 2017-07-04 09:40:45 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2017-07-04 09:40:45 +0100 |
commit | a955065cda3dcaa80058520ba55dc0bf5c8d3f08 (patch) | |
tree | 943ee67f8b9141d65b5bcfacba9d84bf721681bc /Src | |
parent | cdd9402224da17e90b674a135e0183291c3f38ec (diff) | |
download | zsh-a955065cda3dcaa80058520ba55dc0bf5c8d3f08.tar.gz zsh-a955065cda3dcaa80058520ba55dc0bf5c8d3f08.zip |
Delay processing "disown" for superjob.
This is a job forked from the current shell when a job partly
running from the current shell was suspended. When all associated
processes started from the main shell are finished the job is
continued and at this point the disown can complete.
Diffstat (limited to 'Src')
-rw-r--r-- | Src/jobs.c | 8 | ||||
-rw-r--r-- | Src/zsh.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Src/jobs.c b/Src/jobs.c index 32f7daab9..66dfb5a7e 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -277,6 +277,10 @@ handle_sub(int job, int fg) (!jn->procs->next || cp || jn->procs->pid != jn->gleader)) attachtty(jn->gleader); kill(sj->other, SIGCONT); + if (jn->stat & STAT_DISOWN) + { + deletejob(jn, 1); + } } curjob = jn - jobtab; } else if (sj->stat & STAT_STOPPED) { @@ -2375,6 +2379,10 @@ bin_fg(char *name, char **argv, Options ops, int func) printjob(job + (oldjobtab ? oldjobtab : jobtab), lng, 2); break; case BIN_DISOWN: + if (jobtab[job].stat & STAT_SUPERJOB) { + jobtab[job].stat |= STAT_DISOWN; + continue; + } if (jobtab[job].stat & STAT_STOPPED) { char buf[20], *pids = ""; @@ -1029,6 +1029,7 @@ struct job { #define STAT_BUILTIN (0x4000) /* job at tail of pipeline is a builtin */ #define STAT_SUBJOB_ORPHANED (0x8000) /* STAT_SUBJOB with STAT_SUPERJOB exited */ +#define STAT_DISOWN (0x10000) /* STAT_SUPERJOB with disown pending */ #define SP_RUNNING -1 /* fake status for jobs currently running */ |