Sleep not terminating

Christopher Faylor cgf-no-personal-reply-please@cygwin.com
Fri Oct 14 19:43:00 GMT 2005


On Fri, Oct 14, 2005 at 12:36:55PM -0700, David Rothenberger wrote:
>I'm encountering a weird problem with sleep.
>
>If I run
>
>$ while true; do sleep 120; done &
>[1] 6780
>$ kill %1
>
>the bash process (6780) and its child sleep process are both killed.
>
>However, if I kill the bash process using the pid, the child sleep 
>process is not killed.
>
>$ while true; do sleep 120; done &
>[1] 5528
>$ kill 5528
>$ ps -ef | grep sleep
>  drothe    6532       1   0  12:26:41 /bin/sleep
>
>I guess this problem has been around for a while. I'm seeing it with the 
>latest snapshot and also with 1.5.18, with the latest bash and the test 
>bash.

I don't suppose that you tried this on linux, did you?  Same behavior.

It's what I'd expect.  In the first case, by specifying "%1", you're
killing the process group, which consists of the bash process and the
sleep process.  In the second case, by specifying the bash pid, you're
killing only the bash process.  Since bash apparently doesn't have any
special "kill my subprocess" behavior, I wouldn't expect sleep to go
away.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list