* [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
zsh-workers
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://inbox.vuxu.org/zsh-workers
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V1 zsh-workers zsh-workers/ http://inbox.vuxu.org/zsh-workers \
zsh-workers@zsh.org
public-inbox-index zsh-workers
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://inbox.vuxu.org/vuxu.archive.zsh.workers
code repositories for the project(s) associated with this inbox:
https://git.vuxu.org/mirror/zsh/
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git