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,