move sigterm functionality out
This commit is contained in:
parent
7ad03e91bc
commit
2544184251
1 changed files with 9 additions and 0 deletions
9
src/platform.rs
Normal file
9
src/platform.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
pub async fn sigterm() -> Result<Option<()>, std::io::Error> {
|
||||
#[cfg(unix)]
|
||||
let mut sigterm_handler =
|
||||
tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate())?;
|
||||
#[cfg(unix)]
|
||||
return Ok(sigterm_handler.recv().await);
|
||||
#[cfg(not(unix))]
|
||||
std::future::pending::<None>().await
|
||||
}
|
Loading…
Reference in a new issue