Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: How to kill a spawned process from a reading thread?
I have a code like:
let mut child = Command::new(&path_translated)
.stdout(Stdio::piped())
.stdin(Stdio::piped())
.stderr(Stdio::piped())
.spawn()?;
....
if let Some(mut stdin) = child.stdin.take() {
thread::scope(|s| {
s.spawn(|| {
....
child.kill().expect("Failed to kill child process");
}
if let Some(stderr) = child.stderr.take() {
s.spawn(|| {
Since child
got moved in the first thread, I can't use it for taking stderr
. How can I clone the child, or there is an another technique?
1 post - 1 participant
🏷️ Rust_feed