bug-bash
[Top][All Lists]
Advanced

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

Re: Clarification needed on signal spec EXIT


From: Bob Proulx
Subject: Re: Clarification needed on signal spec EXIT
Date: Tue, 16 Oct 2012 14:00:10 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

Francis Moreau wrote:
> --------------
> main_cleanup () { echo main cleanup; }
> submain_cleanup () { echo sub cleanup; }
> 
> trap main_cleanup EXIT
> 
> task_in_background () {
>         echo "subshell $BASHPID"
> 
>         while :; do
>                 # echo "FOO"
>                 sleep 1
>         done
>         echo "subshell exiting..."
> }
> 
> {
>         trap submain_cleanup EXIT
>         trap
>         task_in_background
> } &
> 
> echo exiting...
> --------------
> 
> Sending TERM signal to the subshell doesn't make "submain_cleanup()"
> to be called.

And it does in ksh93.  Hmm...  And it does if I comment out the line
"trap main_cleanup EXIT".  It seems to only set the trap if no trap
handler was previously set.

Bob



reply via email to

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