-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
First of all, thanks for a great library!
Some entirely good Unix pipelines don't work in shell-conduit though. Consider:
$ yes | head
y
y
y
y
y
y
y
y
y
y
$ echo $?
0
$
Shell only returns the exit code of head and ignores yes. Contrast this to shell-conduit:
> run (shell "yes" $| shell "head")
y
y
y
y
y
y
y
y
y
y
*** Exception: The shell command "yes" returned a failure exit code: 141
Indeed, yes seems to return EXIT_FAILURE when the output pipe is broken. This does seem odd, but it doesn't concern normal Unix usage, while it breaks shell-conduit. Interestingly, the conduit alternative doesn't work either:
> run (conduit (yieldMany (repeat "yes\n")) $| shell "head")
yes
yes
yes
yes
yes
yes
yes
yes
yes
yes
*** Exception: <file descriptor: 13>: hClose: resource vanished (Broken pipe)
>
(Piping only a limited number works:
> run (conduit (yieldMany (replicate 3 "yes\n")) $| shell "head")
yes
yes
yes
>
About the latter case I am not sure, but at least the former should work, I think, so to be more compatible with the Unix shells we know.
Metadata
Metadata
Assignees
Labels
No labels