On 4/21/16 12:48 PM, Brian Vandenberg wrote: > Description: > > I ran into this issue while experimenting with gnu make and .ONESHELL. > I've boiled the issue down to the following simple example: > > $ newline=$'\n' > $ bash -e -c "trap 'echo handler' INT ERR;/bin/true; sleep 2; > ${newline}/bin/false" > > It will successfully trap if I do the following: > > * hit ^C during the sleep > * use "false" instead of "/bin/false" because that'll use a builtin > * trap on EXIT instead > * remove the newline > * add another command after "/bin/false" > * add another command before "/bin/false" without a newline after it > > If I replace "/bin/false" with a sleep then hit ^C then the INT trap also > won't execute.
Thanks for the report. A variant of your suggestion will be in the next release of bash. (As an aside, many shells optimize the fork out to the extent they won't execute the trap if you use sleep as the last command and send the shell a SIGINT.) Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/