fix: fixes unix specific impl of shutdown_signal (#1061)
This commit is contained in:
parent
b8b57c86af
commit
85c7339e65
1 changed files with 10 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue