-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirecting stderr to stdout #546
Comments
It sends the child's stderr to It would be good to have a way of using the same flow for both stdout and stderr, indeed. It's let parse_out_err t parse ?cwd ?stdin ?env ?executable args =
Switch.run @@ fun sw ->
let r, w = Eio.Process.pipe t ~sw in
try
let child = Eio.Process.spawn ~sw t ?cwd ?stdin ~stdout:w ~stderr:w ?env ?executable args in
Flow.close w;
let output = Buf_read.parse_exn parse r ~max_size:max_int in
Flow.close r;
Eio.Process.await_exn child;
output
with Exn.Io _ as ex ->
let bt = Printexc.get_raw_backtrace () in
Eio.Exn.reraise_with_context ex bt "running command: %a" Eio.Process.pp_args args Not sure what to call the function, or whether it should be merged with |
Thank you! Yep 🤦 Ah that's a good point actually, I was doing this incorrectly by passing in the same buffer sink (to |
I think we should have support for this - it's a common thing to want to do. I'm just not decided on what the best API is. Some options:
|
I don't think we have a convenient way to do this without having to essentially recreate most of what is internal to
Eio_unix.Process
? Is it reasonable to expect the following program to work?I'm guessing it doesn't because internally
stdout
is remapped to a pipe and so we really want to say remapstderr
to whateverstdout
is now mapped to i.e. here:eio/lib_eio/unix/process.ml
Lines 90 to 96 in dbcbd64
But maybe I'm missing something.
The text was updated successfully, but these errors were encountered: