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

Re: Unexpected behavior with pipe_fail and err_return



On Sun, Mar 29, 2020 at 7:29 PM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> On 3/28/20, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
> > () {
> >   emulate -L zsh -o pipe_fail -o err_return
> >   false | while false; do; done
> >   echo $?
> > }
> >
> > This prints "1". Is this expected? I was hoping for no output.
>
> FWIW, you can do this as a workaround
> [...]

I added `|| return` at the end. Works just as well and doesn't fork.

Is this behavior expected? I thought err_return should trigger
everywhere except for conditions under `if` and `while` and rhs of
`||` and `&&`. Are there additional rules that I'm missing?

Roman.



Messages sorted by: Reverse Date, Date, Thread, Author