mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-07 00:00:08 +02:00
process: make Child::kill async (#2823)
* This changes the `Child::kill` to be an async method which awaits the child after sending a kill signal. This avoids leaving zombie processes on Unix platforms if the caller forgets to await the child after the kill completes * A `start_kill` method was also added on `Child` which only sends the kill signal to the child process. This allows for kill signals to be sent even outside of async contexts.
This commit is contained in:
@@ -39,8 +39,7 @@ async fn issue_2174() {
|
||||
time::delay_for(Duration::from_secs(1)).await;
|
||||
|
||||
// Kill the child process.
|
||||
child.kill().unwrap();
|
||||
let _ = child.wait().await;
|
||||
child.kill().await.unwrap();
|
||||
|
||||
assert_err!(handle.await);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user