bug-bash
[Top][All Lists]
Advanced

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

Re: Execution continuing after SIGINT received


From: Kevin Brodsky
Subject: Re: Execution continuing after SIGINT received
Date: Sat, 5 Aug 2017 18:46:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 05/08/2017 03:22, Bob Proulx wrote:
> Kevin Brodsky wrote:
>> $ bash -c '(trap "echo INT; exit 1" INT; sleep 60s); echo after'
>> ^CINT
>> after
>> $
> This is a good example of a bad example case.  You shouldn't "exit 1"
> or you will replace the information that the process is exiting due to
> a signal with an error code.  The trap handler should kill itself
> instead.  Use this test case instead.
>
>> $ bash -c '(trap "echo INT; trap - INT; kill -s INT $$" INT; sleep 60); echo 
>> after'
> Of course that doesn't change the end result here.  But at least the
> program exit WIFSIGNALED information is now correct.
>
> Signal handlers should always raise the signal on themselves after
> handling whatever they need to handle first.
>
> In any case I can't recreate your problem when using real processes in
> separate shells not all on one line.
>
> Bob

You're right Bob, I didn't think about the difference between exit()ing
and being kill()ed, notably in terms of WIFSIGNALED. Chet's reply
explains well the rationale, and it's now clear that the problem is on
Python's side (reproduced in my dummy example!).

Thanks,
Kevin



reply via email to

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