diff options
author | YummyOreo <bobgim20@gmail.com> | 2023-06-19 02:14:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-19 08:14:03 +0100 |
commit | 85c7339e65ec57f5e89fe8b522cf585dee626670 (patch) | |
tree | 76884899862b24563cf4b0f063706c6b66dc835d /atuin-server | |
parent | b8b57c86af9f757b1f13ce439d215cbdc3e3104d (diff) |
fix: fixes unix specific impl of shutdown_signal (#1061)
Diffstat (limited to 'atuin-server')
-rw-r--r-- | atuin-server/src/lib.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/atuin-server/src/lib.rs b/atuin-server/src/lib.rs index aa2250d35..fc4d9e0c0 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<Db: Database>( settings: Settings<Db::Settings>, host: String, |