You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From this function, we took and drop stderr reader, which in my test, not a good idea.
In my simple test, parent process drop reader from child stdout, and child would got a broken pipe error if it's trying to put something to stdout, In Rust, this would cause panic because of this line, but I don't know what would happen in CPP program.
parent code:
fn main() {
let file = "target/release/child";
let mut result = std::process::Command::new(file)
.stdout(Stdio::piped())
.spawn()
.unwrap();
let stdout = result.stdout.take().unwrap();
let mut reader = BufReader::new(stdout);
let mut line = String::new();
reader.read_line(&mut line).unwrap();
println!("read {} bytes", line.len());
drop(reader);
loop {
println!("waiting");
sleep(Duration::from_secs(1));
}
}
From this function, we took and drop stderr reader, which in my test, not a good idea.
In my simple test, parent process drop reader from child stdout, and child would got a broken pipe error if it's trying to put something to stdout, In Rust, this would cause panic because of this line, but I don't know what would happen in CPP program.
parent code:
child code
The text was updated successfully, but these errors were encountered: