Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Failed pipeline doesn't err_exit/return if complex command last



> 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