about summary refs log tree commit diff
path: root/Src/jobs.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2017-07-04 09:40:45 +0100
committerPeter Stephenson <pws@zsh.org>2017-07-04 09:40:45 +0100
commita955065cda3dcaa80058520ba55dc0bf5c8d3f08 (patch)
tree943ee67f8b9141d65b5bcfacba9d84bf721681bc /Src/jobs.c
parentcdd9402224da17e90b674a135e0183291c3f38ec (diff)
downloadzsh-a955065cda3dcaa80058520ba55dc0bf5c8d3f08.tar.gz
zsh-a955065cda3dcaa80058520ba55dc0bf5c8d3f08.tar.xz
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/jobs.c')
-rw-r--r--Src/jobs.c8
1 files changed, 8 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 = "";