|
From: | Chet Ramey |
Subject: | Re: ERR trap, pipeline, and errtrace |
Date: | Fri, 8 Jan 2021 09:02:54 -0500 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 |
On 1/8/21 3:07 AM, Boris Kolpackov wrote:
Chet Ramey <chet.ramey@case.edu> writes:Yes, it's expected.Thanks for confirming.The language is fine; it describes the default behavior of the ERR trap. In the trap command description, the "any command in a pipeline" refers to the function call, and indeed, the trap does not get run even though the exit from the trap handler causes the pipeline element to return a non-zero status.I see what you are saying though that last bit is not quite true ifpipefail is set.
If pipefail is set, the trap doesn't run because that pipeline element returns a non-zero exit status; it runs because pipefail causes the entire
pipeline to return a non-zero exit status. -- ``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/
[Prev in Thread] | Current Thread | [Next in Thread] |