From 85c7339e65ec57f5e89fe8b522cf585dee626670 Mon Sep 17 00:00:00 2001 From: YummyOreo Date: Mon, 19 Jun 2023 02:14:03 -0500 Subject: [PATCH] fix: fixes unix specific impl of shutdown_signal (#1061) --- atuin-server/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/atuin-server/src/lib.rs b/atuin-server/src/lib.rs index aa2250d..fc4d9e0 100644 --- a/atuin-server/src/lib.rs +++ b/atuin-server/src/lib.rs @@ -14,6 +14,7 @@ mod utils; pub use settings::Settings; use tokio::signal; +#[cfg(target_family = "unix")] async fn shutdown_signal() { signal::unix::signal(signal::unix::SignalKind::terminate()) .expect("failed to register signal handler") @@ -22,6 +23,15 @@ async fn shutdown_signal() { eprintln!("Shutting down gracefully..."); } +#[cfg(target_family = "windows")] +async fn shutdown_signal() { + signal::windows::ctrl_c() + .expect("failed to register signal handler") + .recv() + .await; + eprintln!("Shutting down gracefully..."); +} + pub async fn launch( settings: Settings, host: String,