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

Re: disowning stopped jobs



On Mon, Jun 25, 2001 at 11:00:56AM +0200,
Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> 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.

Good idea, IMHO.

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

Well, I just have a minor quetion, see at end.

[...]
> 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;
>  	}

Shouldn't there be a space between 'T' and '%' in the marked places?
Or does "pids" contain a space at the beginning?
(Just thrown in because it looks strange, I don't really know anything
about that "pids" variable, what does dyncat() do to it?)

Ciao,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@xxxxxxxxxxxxxxxxx     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships

Attachment: pgpISDyH1vRJJ.pgp
Description: PGP signature



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