Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Failed pipeline doesn't err_exit/return if complex command last
- X-seq: zsh-workers 51909
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Johan Grande <nahoj@xxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: Failed pipeline doesn't err_exit/return if complex command last
- Date: Thu, 6 Jul 2023 10:44:00 +0100 (BST)
- Archived-at: <https://zsh.org/workers/51909>
- Importance: Normal
- In-reply-to: <0c1f1b1e-7d2b-ec6b-3044-dc25b6d5a4d5@crans.org>
- List-id: <zsh-workers.zsh.org>
- References: <0c1f1b1e-7d2b-ec6b-3044-dc25b6d5a4d5@crans.org>
> On 06/07/2023 00:18 Johan Grande <nahoj@xxxxxxxxx> wrote:
> I noticed a strange behavior when using a complex command in a pipeline.
>
> With `set -eo pipefail`, a failing pipeline that ends in a complex
> command will have non-zero status but not exit the script (or a function
> with err_return):
So in a nutshell
fn() {
emulate -L zsh
setopt errreturn pipefail
false | { true }
print "Shouldn't get here, status $?"
}
The final part of the pipeline is run in the current shell, so the
job control is a bit fiddly. It looks like the relevant code,
including the function storepipestats(), is run too late in this
case.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author