[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [jobs doesnt report status correctly on kill -CONT

From: Chet Ramey
Subject: Re: [jobs doesnt report status correctly on kill -CONT
Date: Tue, 10 Apr 2001 09:36:49 -0400

> Machine Type: i586-mandrake-linux-gnu
> Bash Version: 2.04
> Patch Level: 12
> Release Status: release
> Description:
> There seems to be a problem with the 'jobs' command. It doesnt report the
> status of a job correctly when you send a background job a SIGSTOP signal,
> followed by a SIGCONT signal using the kill command. If I start a job in the
> background, using the '&' at the end, and then issue a kill -STOP followed
> by a kill -CONT, 'jobs' *still* reports the job as being stopped, even
> though in reality it is actually running again.

This is tricky.  Some systems (Solaris 2.6) send the shell a SIGCHLD
when the child is continued, some (FreeBSD 4.2, BSD/OS 4.2, Red Hat 7)
don't.  There's also no portable way to tell waitpid(2) we're
interested in whether or not a child process was continued.  Solaris
has WCONTINUED, but most BSD and Linux systems don't.

We can finesse this when using job ids (%1, etc.) because we can be sure
that we're sending the signal to every process in the job, and we can set
the state of the entire pipeline accordingly.  When we're just killing a
single pid, we can't tell whether it's part of a pipeline, and what the
state of all the processes in the pipeline might be.

I'll probably add something to take advantage of WCONTINUED where it's
available, but that doesn't help everywhere.


``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)

Chet Ramey, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]