Skip to content

Commit

Permalink
fix: Build on Windows (#142)
Browse files Browse the repository at this point in the history
The signal handler for graceful shutdown is unix only. This commit
removes it for Windows builds.
  • Loading branch information
shouya committed Aug 6, 2024
1 parent 368aa68 commit 3701b4a
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 3701b4a

Please sign in to comment.