Pipe stdout and stderr to two separate commands #485
Comments
The pipe symbol always connect stdout of the previous command with the stdin of the next command. stderr does not participate in pipelining; I do not know of any shells where stderr does. |
@xiaq thanks, I supposed as much. Powershell can do it if you use the process api, but that's mainly cheating. I cannot stress how amazing (and unique) it would be if it were possible to come up with a nice, elegant way of operating on both stderr and stdout separately, without blocking, in elvish. It would be the killer feature everyone needs and they don't even realize it, and elvish would be the only shell to provide that out-of-the-box. The primary issue with with working on both is parsing intent. Presuming stream redirection operators like
is parsed is ambiguous. Is the stderror redirection meant to apply to
|
@mqudsi Thanks for clarifying things. For new shell features, it is often much more tricky to come up with a sensible syntax than a sensible semantics. Welcome to shell design :) There is a more conservative approach though. Elvish already supports building and manipulating pipes with the What Elvish still lacks is a construct for running several things in parallel, and wait for them to finish. The pipeline is actually very close to such a construct: in What can work is a (say) builtin pout = (pipe)
perr = (pipe)
run-parallel {
foo > $pout 2> $perr
pwclose $pout
pwclose $perr
} {
bar < $pout
prclose $pout
} {
bar2 < $perr
prclose $perr
} |
FWIW, @xiaq, I don't see where any of |
@krader1961 Sorry, Good catch for missing doc. I updated the source code but cannot push to prod today, my VPS seems blocked by GFW :-/ |
Updated: https://elvish.io/ref/builtin.html#pipe I also documented |
I have added a For the possibility of extending the pipeline syntax, please discuss in #500. |
I haven't dug into this too deeply, but by looking through the documentation and testing a few things, it does not seem that it is possible to operate on both stdout and stderr streams simultaneously (but separately)
Is it not possible to redirect both?
The text was updated successfully, but these errors were encountered: