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;
|
pub use settings::Settings;
|
||||||
use tokio::signal;
|
use tokio::signal;
|
||||||
|
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
async fn shutdown_signal() {
|
async fn shutdown_signal() {
|
||||||
signal::unix::signal(signal::unix::SignalKind::terminate())
|
signal::unix::signal(signal::unix::SignalKind::terminate())
|
||||||
.expect("failed to register signal handler")
|
.expect("failed to register signal handler")
|
||||||
|
@ -22,6 +23,15 @@ async fn shutdown_signal() {
|
||||||
eprintln!("Shutting down gracefully...");
|
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>(
|
pub async fn launch<Db: Database>(
|
||||||
settings: Settings<Db::Settings>,
|
settings: Settings<Db::Settings>,
|
||||||
host: String,
|
host: String,
|
||||||
|
|
Loading…
Reference in a new issue