diff options
| -rw-r--r-- | crates/whirl/Cargo.toml | 1 | ||||
| -rw-r--r-- | crates/whirl/src/lib.rs | 17 |
2 files changed, 7 insertions, 11 deletions
diff --git a/crates/whirl/Cargo.toml b/crates/whirl/Cargo.toml index 156c22f..d927fb4 100644 --- a/crates/whirl/Cargo.toml +++ b/crates/whirl/Cargo.toml @@ -66,4 +66,3 @@ jemallocator = "0.3.2" # Signal signal-hook = "0.3.9" -signal-hook-tokio = "0.3.0" diff --git a/crates/whirl/src/lib.rs b/crates/whirl/src/lib.rs index 6a0774b..0233b20 100644 --- a/crates/whirl/src/lib.rs +++ b/crates/whirl/src/lib.rs @@ -40,8 +40,6 @@ pub mod cli; #[cfg(unix)] use signal_hook::consts::signal::{SIGINT, SIGTERM}; -#[cfg(unix)] -use tokio_stream::StreamExt; use whirl_config::Config; pub struct Whirl; @@ -84,14 +82,13 @@ impl Whirl { // Ctrl+C handling #[cfg(unix)] - tokio::spawn({ - while let Some(signal) = signal_hook_tokio::Signals::new(&[SIGTERM, SIGINT]).fuse() { - match signal { - _ => { - info!("signal received: {:?}, killing whirl", signal); - std::process::exit(0); - } - } + tokio::spawn(async move { + for signal in signal_hook::iterator::Signals::new(&[SIGTERM, SIGINT]) + .unwrap() + .forever() + { + info!("signal received: {:?}, killing whirl", signal); + std::process::exit(0); } }); |