[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SIGINT handling
From: |
Chet Ramey |
Subject: |
Re: SIGINT handling |
Date: |
Thu, 24 Sep 2015 14:40:26 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
On 9/22/15 8:18 AM, Greg Wooledge wrote:
> On Mon, Sep 21, 2015 at 10:07:55PM +0100, Stephane Chazelas wrote:
>> Maybe the test scenario was not clear:
>>
>> bash -c 'cmd; echo hi'
>>
>> is run from an interactive shell, cmd is a long running
>> application (the problem that sparked this discussion was with
>> ping and I showed examples with an inline-script calling sleep)
>
> Just for the record, ping is the *classic* example of an incorrectly
> written application that traps SIGINT but doesn't kill itself with
> SIGINT afterward. (This seems to be true on multiple systems -- at
> the very least, HP-UX and Linux pings both suffer from it.)
>
> A loop like this works as expected:
>
> while true; do
> sleep 1
> done
>
> A loop like this does not:
>
> while true; do
> ping -c 1 some.host # or on HP-UX, ping some.host -n 1
> done
If you decide, as bash has, to allow the foreground job to determine what
to do with SIGINT, you have to cope with software like ping.
--
``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/
- Re: SIGINT handling, (continued)
- Re: SIGINT handling, Stephane Chazelas, 2015/09/20
- Re: SIGINT handling, Stephane Chazelas, 2015/09/20
- Re: SIGINT handling, Chet Ramey, 2015/09/21
- Re: SIGINT handling, Stephane Chazelas, 2015/09/21
- Re: SIGINT handling, Stephane Chazelas, 2015/09/22
- Re: SIGINT handling, Stephane Chazelas, 2015/09/22
- Re: SIGINT handling, Greg Wooledge, 2015/09/22
- Re: SIGINT handling, Stephane Chazelas, 2015/09/22
- Re: SIGINT handling, Bob Proulx, 2015/09/22
- Re: SIGINT handling, Stephane Chazelas, 2015/09/22
- Re: SIGINT handling,
Chet Ramey <=
- Re: SIGINT handling, Chet Ramey, 2015/09/24
- Re: SIGINT handling, Chet Ramey, 2015/09/23
- Re: SIGINT handling, Chet Ramey, 2015/09/23
- Re: SIGINT handling, Stephane Chazelas, 2015/09/24
- Re: SIGINT handling, Stephane Chazelas, 2015/09/24
- Re: SIGINT handling, Pádraig Brady, 2015/09/24
- Re: SIGINT handling, Stephane Chazelas, 2015/09/24
- Re: SIGINT handling, Stephane Chazelas, 2015/09/24
- Re: SIGINT handling, Chet Ramey, 2015/09/24
- Re: SIGINT handling, Stephane Chazelas, 2015/09/24