From 9a95d297678c4ba9e33f22c4e8e17173ce393878 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Mon, 22 Apr 2024 02:19:21 +0100 Subject: Add cfg(unix) to tokio::signal code --- src/main.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 9b10935..f4a7bde 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,6 +11,7 @@ use clap::Parser; use human_panic::setup_panic; use anyhow::{bail, Context, Result}; +#[cfg(unix)] use tokio::signal::unix::{signal, SignalKind}; use tokio::time::sleep; @@ -43,6 +44,7 @@ fn set_signal_handlers() -> Result<()> { warn!("received ctrl-c signal. Exiting..."); exit(0) }); + #[cfg(unix)] tokio::spawn(async move { let mut stream = match signal(SignalKind::terminate()) { Err(e) => return e, @@ -52,6 +54,7 @@ fn set_signal_handlers() -> Result<()> { warn!("received process termination signal. Exiting..."); exit(0) }); + #[cfg(unix)] tokio::spawn(async move { let mut stream = match signal(SignalKind::hangup()) { Err(e) => return e, -- cgit v1.2.3-70-g09d2