Skip to content
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

doc request: example how to inherit stdout/stderr in Command #21570

Closed
kornelski opened this issue Jan 23, 2015 · 4 comments
Closed

doc request: example how to inherit stdout/stderr in Command #21570

kornelski opened this issue Jan 23, 2015 · 4 comments

Comments

@kornelski
Copy link
Contributor

std::io::Command by default creates new stdout/stderr for the command.

I don't see an obvious way to make it use same stdout/stderr as the parent process. Could you add an example that shows how to this?

Typically own stdout/stderr is a very desirable behavior, but in Cargo build scripts this hides output of commands and makes debugging difficult, so in that context inherited stdin/stdout is a common and useful use-case.

@steveklabnik
Copy link
Member

holidng off until new io lands /cc @alexcrichton

@sfackler
Copy link
Member

sfackler commented Feb 6, 2015

Here's an example while we wait for new IO: https://github.com/sfackler/rust-postgres-macros/blob/master/build.rs#L9-L11

@steveklabnik
Copy link
Member

#22119 is the PR to merge the relevant new functionality

@steveklabnik
Copy link
Member

It was merged! Comand::new says:

    /// * Inherit stdin/stdout/stderr for `run` or `status`, but create pipes for `output`

so this behavior has changed to be the default. Therefore, I'm giving this a close. Of course, I plan on adding tons of examples, but this specific one is addressed already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants