* [BUG] Pipe fails even when using ' || true '
@ 2021-03-26 12:53 Rudi C
0 siblings, 0 replies; only message in thread
From: Rudi C @ 2021-03-26 12:53 UTC (permalink / raw)
To: zsh-workers
This pipe unexpectedly fails:
```
$ setopt pipefail
$ { print -nr -- "x" || true } | eval 'print -rn --
"${(q+@)brish_stdin}"' ; echo $'\n'Returned
$?:"${(j.|.)pipestatus[@]}"
''
Returned 141:141|0
```
This is the simplest thing I have found that works:
```
$ ( ( print -nr -- "l" ) || true ) | eval 'print -rn --
"${(q+@)brish_stdin}"' ; echo $'\n'Returned
$?:"${(j.|.)pipestatus[@]}"
''
Returned 0:0|0
```
Even this fails:
```
$ ( { print -nr -- "l" } || true ) | eval 'print -rn --
"${(q+@)brish_stdin}"' ; echo $'\n'Returned
$?:"${(j.|.)pipestatus[@]}"
''
Returned 141:141|0
```
The behavior is nondeterministic on macOS, and it actually doesn't
usually fail at all!
```
$ for i in {1..100} ; { { print -nr -- "x" || true } | eval 'print -rn
-- "${(q+@)brish_stdin}"' ;echo $'\n'Returned
$?:"${(j.|.)pipestatus[@]}" }
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 141:141|0
''
Returned 0:0|0
''
Returned 0:0|0
''
Returned 0:0|0
```
BTW, there seems to be another weird thing going on; Adding two spaces
before `echo` breaks the whole loop both on Linux and macOS:
```
for i in {1..100} ; { { print -nr -- "x" || true } | eval 'print -rn
-- "${(q+@)brish_stdin}"' ; echo $'\n'Returned
$?:"${(j.|.)pipestatus[@]}" }
''zsh: command not found:
''zsh: command not found:
''zsh: command not found:
''zsh: command not found:
...
```
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-26 12:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 12:53 [BUG] Pipe fails even when using ' || true ' Rudi C
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).