zsh-workers
 help / color / mirror / code / Atom feed
* disowning stopped jobs
@ 2001-06-25  9:00 Sven Wischnowsky
  2001-06-25  9:12 ` Thomas Köhler
  2001-06-25 15:08 ` Bart Schaefer
  0 siblings, 2 replies; 10+ messages in thread
From: Sven Wischnowsky @ 2001-06-25  9:00 UTC (permalink / raw)
  To: zsh-workers

If one tries bash-2.04:

  % sleep 80
  ^Z
  [1]+  Stopped                    sleep 80
  % disown %1
  bash: warning: deleting stopped job 1 with process group 988

I.e., it prints what Bart suggested we should print.  I answered that by
saying that this is slightly more complicated for us because there may
also be a sub-job to be continued in such cases.

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.

Below is a patch for this, which I won't commit until I get positive
replies.

Any better wording?  Should we print the `kill ...' indented on its own
line? (The list of pids can get a bit longer, because the patch makes it
use the same loops used by killjb() for super-jobs where we send all
processes the CONT signal.)


Bye
  Sven

diff -ur -r ../oz/Src/jobs.c ./Src/jobs.c
--- ../oz/Src/jobs.c	Sat Jun 23 22:12:56 2001
+++ ./Src/jobs.c	Sat Jun 23 22:42:33 2001
@@ -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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-10-10  2:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-25  9:00 disowning stopped jobs 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   ` PATCH: " Sven Wischnowsky
2001-06-26  8:19     ` Sven Wischnowsky
2001-06-26 16:40     ` Bart Schaefer
2001-06-27 11:18       ` Sven Wischnowsky
2001-10-10  2:40     ` Clint Adams

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).