bug-bash
[Top][All Lists]
Advanced

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

Re: Trap does not work if a subshell wait(s) for job


From: Chet Ramey
Subject: Re: Trap does not work if a subshell wait(s) for job
Date: Fri, 20 Feb 2015 10:04:16 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2/18/15 8:06 AM, Dr. Werner Fink wrote:
> Hi,
> 
> found due to a hang in the test suite of gnutls, after debugging I've
> extract the example code
> 
>      launch_server () { sleep 100 & l=$!; trap "kill -15 $l" 15; echo $l; 
> wait $l; }
>      launch_server & x=$!
>      sleep 2
>      kill $x
> 
> which does wait the full 100 seconds with bash 4.3 but with the old bash 4.2 
> only 2 seconds.

It sleeps 2 seconds on Mac OS X, Debian 7, Ubuntu 14, OpenSuSE 13, and
RHEL 5.  Check whether or not SIGTERM is trapped or ignored when you run
the script.


- -- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)

iEYEARECAAYFAlTnTPAACgkQu1hp8GTqdKsL0ACeJIi8wbkDqT2ZxJPF7xU99Y4h
WiMAn1BxOheMJyrbnLlqqg+GGACzPKi4
=DvS9
-----END PGP SIGNATURE-----



reply via email to

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