Redirect output of child process to end-user?

I'm attempting to write a small CLI program that does some arbitrary work before spawning a child process and handing control over to the end-user. I have everything working except I'm struggling to figure out how to "hand control" over to the end-user after spawning the process using Command. My initial guess is somehow forwarding stdio from the child process to the Rust process, but I'm not sure if that's the best way or even possible.

Any guidance on how I can accomplish this?

Looking at how Cargo does this might be helpful: https://github.com/rust-lang/cargo/blob/9a3c162dc3b912cde1a0f436958adb2cb8f21e5e/crates/cargo-util/src/process_builder.rs#L183-L200

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.