* Unexpected behavior with pipe_fail and err_return
@ 2020-03-28 22:19 Roman Perepelitsa
2020-03-29 17:29 ` Mikael Magnusson
0 siblings, 1 reply; 3+ messages in thread
From: Roman Perepelitsa @ 2020-03-28 22:19 UTC (permalink / raw)
To: Zsh Users
() {
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.
Roman.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Unexpected behavior with pipe_fail and err_return
2020-03-28 22:19 Unexpected behavior with pipe_fail and err_return Roman Perepelitsa
@ 2020-03-29 17:29 ` Mikael Magnusson
2020-03-29 17:34 ` Roman Perepelitsa
0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2020-03-29 17:29 UTC (permalink / raw)
To: Roman Perepelitsa; +Cc: Zsh Users
On 3/28/20, Roman Perepelitsa <roman.perepelitsa@gmail.com> 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
() {
emulate -L zsh -o pipe_fail -o err_return
( false | while false; do; done )
echo $?
}
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Unexpected behavior with pipe_fail and err_return
2020-03-29 17:29 ` Mikael Magnusson
@ 2020-03-29 17:34 ` Roman Perepelitsa
0 siblings, 0 replies; 3+ messages in thread
From: Roman Perepelitsa @ 2020-03-29 17:34 UTC (permalink / raw)
To: Mikael Magnusson; +Cc: Zsh Users
On Sun, Mar 29, 2020 at 7:29 PM Mikael Magnusson <mikachu@gmail.com> wrote:
> On 3/28/20, Roman Perepelitsa <roman.perepelitsa@gmail.com> 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-29 17:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-28 22:19 Unexpected behavior with pipe_fail and err_return Roman Perepelitsa
2020-03-29 17:29 ` Mikael Magnusson
2020-03-29 17:34 ` Roman Perepelitsa
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).