-
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
stdin inherits by default on unix, not on windows #32254
Comments
Is this correct? I tested this program and it works fine on Windows/Unix: use std::env;
use std::io;
use std::process::Command;
fn main() {
if env::args().len() == 1 {
let s = Command::new(env::current_exe().unwrap())
.arg("foo")
.status()
.unwrap();
assert!(s.success());
} else {
let mut s = String::new();
println!("{:?}", io::stdin().read_line(&mut s));
println!("{}", s);
}
} Is there perhaps another test case to try out though? |
That test case is using I confirmed that, with the current nightly, the test case fails on Linux -- i.e. I then tried changing the call to |
I am pretty confused now. After going back and checking both Unix and Windows I now have to have |
I think this part isn't Rust related; I reproduced it with Python. The parent dies before the child, making the child an orphan, and somehow that interferes with the child's access to the pty. |
@alexcrichton Ok, my scenario is actually more complicated. This is the executable proxy code in multirust-rs. In response to |
Ah excellent diagnosis @rprichard! I think this was a bug introduced by #31618, I'll work on a fix. |
This regression was accidentally introduced in rust-lang#31618, and it's just flipping a boolean! Closes rust-lang#32254
…uron std: Fix inheriting stdin on status() This regression was accidentally introduced in rust-lang#31618, and it's just flipping a boolean! Closes rust-lang#32254
…uron std: Fix inheriting stdin on status() This regression was accidentally introduced in rust-lang#31618, and it's just flipping a boolean! Closes rust-lang#32254
In multirust-rs I discovered that the proxy binaries must add
command.stdin(process::Stdio::inherit());
to the child commad in order for stdin to work in the subprocess, but only on windows. On unix it works by default.The text was updated successfully, but these errors were encountered: