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

Reply via email to