bug-bash
[Top][All Lists]
Advanced

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

Re: trap EXIT in piped subshell not triggered during wait


From: Chet Ramey
Subject: Re: trap EXIT in piped subshell not triggered during wait
Date: Sun, 14 Apr 2013 19:55:51 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130307 Thunderbird/17.0.4

On 4/13/13 1:35 AM, Ilya Basin wrote:
> Hi!
> I've got strange behavior. Here's my script:
> 
>     #!/bin/bash
>     {
>         trap '
>             echo "in trap EXIT">&2
>         ' EXIT
>         sleep 4 &
>         echo 'sleep 2'>&2
>         sleep 2
>         echo 'wait $!'>&2
>         wait $!
>         echo 'exit'>&2
>         exit
>     } | cat
> 
> If I press Ctrl-C during wait, the trap isn't triggered.
> If I replace curly brackets with round brackets, it works. What's the
> difference?

Thanks for the report.  This was fixed a few months ago and the fix is in
the devel branch.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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