-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
std::process::Command misses a way to get back stdin, stdout, stderr #32394
Comments
What's the reason that the |
Not taking them by value would mean the function setting the |
What I'd like to do maybe in theory is to write functions like this: fn echo_foo_into_pipe(pipe: &SomePipeObject) {
let command = Command::new("echo");
// ...have it talk to the pipe somehow
} The idea here is that by taking a shared reference to the pipe, the function could promise not to do anything destructive like closing it. The // Promises to return the argument when it's done. But *does it*!?
fn echo_foo_into_pipe(pipe: SomePipeObject) -> SomePipeObject { ... } The downside of this to me, besides being a little more annoying to use, is that it's no longer possible to define This is coming up for me because I want to spawn several shell commands talking to the same pipe. At the end of the day, it will be perfectly fine for me to build each |
Please note that |
Seems reasonable. Let's track this under #44434, the more general issue of extracting fields from Command. |
I'm not sure if this requires a RFC, but we have the
StdIo
s within theCommand
, and it seems prudent not to waste them when it is dropped. So how about a function to decompose theCommand
into its IOs?The following code would work (in
std::process::Command
):The text was updated successfully, but these errors were encountered: