Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
disowning stopped jobs
- X-seq: zsh-workers 15063
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: disowning stopped jobs
- Date: Mon, 25 Jun 2001 11:00:56 +0200 (MET DST)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author