Fwd: Bug when trapping exit from subshell

2014-05-19 Thread Mark Ferrell
On Mon, May 19, 2014 at 10:45 AM, Greg Wooledge wrote: > On Mon, May 19, 2014 at 10:39:59AM -0700, Mark Ferrell wrote: >> I'm sorry, but the lack of consistency still sounds like it is a bug >> in bash. The behaviour I would expect is functionally equivalent to >>

Re: Bug when trapping exit from subshell

2014-05-19 Thread Mark Ferrell
/dev/null 2>&1 || err_handler set -e exit_handler() { echo "exit code: $?"; } main() {( trap exit_handler 0 /bin/false >> /dev/null 2>&1 )} main "$@" On Mon, May 19, 2014 at 7:00 AM, Chet Ramey wrote: > On 5/18/14, 12:56 PM, Mark Ferrell wrote: &

Re: Bug when trapping exit from subshell

2014-05-18 Thread Mark Ferrell
e exit handler is called, you just muted it. remove the redirections, and > you'll also notice you need a space after your ! > > > On 16 May 2014 12:41, Mark Ferrell wrote: >> >> The following script properly reports the exit code to the calling >> environment, , b

Bug when trapping exit from subshell

2014-05-16 Thread Mark Ferrell
The following script properly reports the exit code to the calling environment, , but the exit handler is not called if a function triggers the exit vs an external command. Script executed via: bash