-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Seems to be a cancel safety issue, this happens when i wait() with a timeout and then wait() again:
This reproducer:
use command_group::AsyncCommandGroup;
use tokio::process::Command;
#[tokio::main]
async fn main() {
let mut group = Command::new("sh")
.arg("-c")
.arg("sleep 30; echo done!")
.group_spawn()
.unwrap();
println!("spawned");
match tokio::time::timeout(std::time::Duration::from_secs(1), group.wait()).await {
Ok(res) => {
println!("command exited or waiting failed: {res:?}");
}
Err(_) => {
println!("command took too long");
}
}
group.kill().unwrap();
println!("killed");
group.wait().await.unwrap();
println!("finished waiting");
}Prints this on my machine:
spawned
command took too long
killed
thread 'main' panicked at src/main.rs:26:24:
called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "blocking waitpid returned pid=0" }
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels