Skip to content

Commit

Permalink
only start unix signal handler on unix
Browse files Browse the repository at this point in the history
  • Loading branch information
shouya committed Aug 6, 2024
1 parent 368aa68 commit 44d4071
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ use crate::util::Result;
async fn main() -> Result<()> {
tracing_subscriber::fmt::init();

tokio::spawn(async {
signal_handler().await.expect("Signal handler failed");
});
if cfg!(unix) {
tokio::spawn(async {
signal_handler().await.expect("Signal handler failed");
});
}

let cli = cli::Cli::parse();
cli.run().await
}

#[cfg(unix)]
async fn signal_handler() -> Result<()> {
use tokio::signal::unix::{signal, SignalKind};

Expand Down

0 comments on commit 44d4071

Please sign in to comment.