forked from lavina/lavina
1
0
Fork 0

fix for windows

This commit is contained in:
Nikita Vilunov 2023-07-30 18:59:33 +02:00
parent c1a461a09e
commit 4b04696a4f
1 changed files with 11 additions and 0 deletions

View File

@ -67,6 +67,17 @@ async fn main() -> Result<()> {
Ok(())
}
#[cfg(windows)]
fn ctrl_c() -> Result<impl Future<Output = ()>> {
use tokio::signal::windows::*;
let chan = ctrl_c()?;
async fn recv(mut chan: CtrlC) {
let _ = chan.recv().await;
}
Ok(recv(chan))
}
#[cfg(unix)]
fn ctrl_c() -> Result<impl Future<Output = ()>> {
use tokio::signal::unix::*;
let chan = signal(SignalKind::interrupt())?;