From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12045 invoked from network); 26 Jun 2001 08:17:12 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 26 Jun 2001 08:17:12 -0000 Received: (qmail 24721 invoked by alias); 26 Jun 2001 08:16:23 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15087 Received: (qmail 24703 invoked from network); 26 Jun 2001 08:16:22 -0000 From: Sven Wischnowsky Date: Tue, 26 Jun 2001 10:15:12 +0200 (MET DST) Message-Id: <200106260815.KAA23752@beta.informatik.hu-berlin.de> To: zsh-workers@sunsite.dk Subject: PATCH: Re: disowning stopped jobs In-Reply-To: <1010625150802.ZM13500@candle.brasslantern.com> Bart Schaefer wrote: > On Jun 25, 11:00am, Sven Wischnowsky wrote: > } Subject: disowning stopped jobs > } > } Maybe we can `solve' (or, rather, circumvent) this problem by being more > } verbose, saying `warning: job is stopped, use `kill -CONT ...' to resume'. > } That way, users can even use cut&paste to make the job running. > } > } Any better wording? Should we print the `kill ...' indented on its own > } line? > > I think it's OK as it is, at least until we get some empirical feedback. Fine, I'm going to commit it to the development branch, should it go into 4.0.2, too? > What about my other suggestion, that `%job &!' should use `bg' and then > handle the job table in exec.c ? I looked into this shortly, it would require us to export getjob() and then should be relatively simple. But. Just had an idea. Why not give an option to disown, say `-c' for `continue', that makes it wake up stopped jobs before disowning them? With that, users could alias `disown' to `disown -c' to never have to worry about that anymore and in execcmd() we just would have to stick the `-c' into the list. Bye Sven Index: Src/jobs.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v retrieving revision 1.11 diff -u -r1.11 jobs.c --- Src/jobs.c 2001/05/29 09:49:58 1.11 +++ Src/jobs.c 2001/06/26 08:12:37 @@ -1392,14 +1392,36 @@ printjob(job + jobtab, lng, 2); break; case BIN_DISOWN: - if (jobtab[job].stat & STAT_STOPPED) + if (jobtab[job].stat & STAT_STOPPED) { + char buf[20], *pids = ""; + + if (jobtab[job].stat & STAT_SUPERJOB) { + Process pn; + + for (pn = jobtab[jobtab[job].other].procs; pn; pn = pn->next) { + sprintf(buf, " -%d", pn->pid); + pids = dyncat(pids, buf); + } + for (pn = jobtab[job].procs; pn->next; pn = pn->next) { + sprintf(buf, " %d", pn->pid); + pids = dyncat(pids, buf); + } + if (!jobtab[jobtab[job].other].procs && pn) { + sprintf(buf, " %d", pn->pid); + pids = dyncat(pids, buf); + } + } else { + sprintf(buf, " -%d", jobtab[job].gleader); + pids = buf; + } zwarnnam(name, #ifdef USE_SUSPENDED - "warning: job is suspended", + "warning: job is suspended, use `kill -CONT%s' to resume", #else - "warning: job is stopped", + "warning: job is stopped, use `kill -CONT%s' to resume", #endif - NULL, 0); + pids, 0); + } deletejob(jobtab + job); break; } -- Sven Wischnowsky wischnow@informatik.hu-berlin.de