Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Disowning a stopped job

Bart Schaefer wrote:

> Using "disown" on a stopped job leaves the job stopped.  There should be at
> least a warning about this.

Nobody answered -- or did I miss something?

The patch below makes it print a warning. Simple change, but I'm not
sure I like it. It looks as if disown were complaining, i.e. as if it
didn't actually disown the job. I tried to make that clearer by putting
that `warning' in the message, but still...

The other possibilities would of course be to generate an error, not
disowning the job or to call makerunning() on it before clearing the job
table entry.

Of these, I think I prefer the former. The user can then still call `bg'
and then `disown'.


Index: Src/jobs.c
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.10
diff -u -r1.10 jobs.c
--- Src/jobs.c	2001/02/20 09:16:47	1.10
+++ Src/jobs.c	2001/05/29 09:24:49
@@ -1392,6 +1392,14 @@
 	    printjob(job + jobtab, lng, 2);
 	case BIN_DISOWN:
+	    if (jobtab[job].stat & STAT_STOPPED)
+                zwarnnam(name,
+                         "warning: job is suspended",
+                         "warning: job is stopped",
+                         NULL, 0);
 	    deletejob(jobtab + job);

Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx

Messages sorted by: Reverse Date, Date, Thread, Author