zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: PATCH: Re: disowning stopped jobs
Date: Tue, 26 Jun 2001 10:15:12 +0200 (MET DST)	[thread overview]
Message-ID: <200106260815.KAA23752@beta.informatik.hu-berlin.de> (raw)
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


  reply	other threads:[~2001-06-26  8:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-25  9:00 Sven Wischnowsky
2001-06-25  9:12 ` Thomas Köhler
2001-06-25  9:17   ` Sven Wischnowsky
2001-06-25  9:25     ` Thomas Köhler
2001-06-25 15:08 ` Bart Schaefer
2001-06-26  8:15   ` Sven Wischnowsky [this message]
2001-06-26  8:19     ` PATCH: " Sven Wischnowsky
2001-06-26 16:40     ` Bart Schaefer
2001-06-27 11:18       ` Sven Wischnowsky
2001-10-10  2:40     ` Clint Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200106260815.KAA23752@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).