help-bash
[Top][All Lists]
Advanced

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

Re: Should trap be removed in pipeline?


From: Chet Ramey
Subject: Re: Should trap be removed in pipeline?
Date: Wed, 20 Jan 2021 11:08:48 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.1

On 1/19/21 3:44 PM, Peng Yu wrote:
Hi,

See below. Depending on how a pipeline is called, the trap inside the
pipeline may or may not be called.

$ bash --version | head -n 1
GNU bash, version 5.0.18(1)-release (x86_64-apple-darwin19.5.0)
$ cat ./main.sh
#!/usr/bin/env bash
true | trap 'echo called trap' EXIT
$  ./main.sh

Thanks for the report. This is fixed in bash-5.1. I made the change in
August, 2019 as the result of

https://savannah.gnu.org/support/?109840


--
``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]