bug-bash
[Top][All Lists]
Advanced

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

Re: exit trap defined in function body isn't triggered


From: Chet Ramey
Subject: Re: exit trap defined in function body isn't triggered
Date: Mon, 30 Mar 2020 17:16:04 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 3/30/20 2:45 PM, Oğuz wrote:
> Consider this:
> 
> bash <<EOF
> foo() {
>   trap 'echo exit' EXIT
> }
> foo &
> EOF
> 
> After trap is set, the subshell exits and `echo exit` should be run,
> but it won't. If you set a RETURN trap instead it works though. This
> is reproducible on bash4 and bash5

Thanks for the report. This was fixed back in August 2019 in the devel
branch.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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