Crates.io | tokio-process-terminate |
lib.rs | tokio-process-terminate |
version | 0.3.2 |
source | src |
created_at | 2023-11-08 07:45:46.922265 |
updated_at | 2024-01-02 11:18:20.453544 |
description | A tokio process extension to terminate child processes |
homepage | https://github.com/zitsen/tokio-process-terminate |
repository | https://github.com/zitsen/tokio-process-terminate.git |
max_upload_size | |
id | 1028828 |
size | 14,057 |
Extensions to tokio::process::Child
to terminate processes.
use tokio::process::Command;
use tokio_process_terminate::TerminateExt;
#[tokio::main]
async fn main() {
let mut command = Command::new("sleep")
.arg("10")
.spawn()
.unwrap();
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
let exit = command.terminate_wait().await.unwrap();
dbg!(exit);
let code = exit.code();
// On Unix, code should be `None` if the process was terminated by a signal.
assert!(code.is_none());
}