Closed
Description
Rust assumes stdio handles are opened for synchronous access (as will most other Windows processes). However, when passing ChildStdOut
, ChildStdIn
or ChildStdErr
to a new Command
the pipes passed in are asynchronous. For a full test case see src/test/ui-fulldeps/stdio-from.rs but here's a shorter example:
fn try_it(a: &mut Child, b: &mut Child) -> io::Result<()> {
let mut child = Command::new("application")
.stdin(a.stdout.take().unwrap())
.stdout(b.stdin.take().unwrap())
.spawn()?;
assert!(child.wait()?.success());
Ok(())
}
This is related to an older issue: #38811 (comment)
This can cause soundness issues described in #81357.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment