fix: double ^C actually stops
parent
bca29fa542
commit
e398f92728
|
@ -2696,6 +2696,16 @@ dependencies = [
|
|||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook"
|
||||
version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"signal-hook-registry",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.1"
|
||||
|
@ -3250,6 +3260,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_json",
|
||||
"shadow-rs",
|
||||
"signal-hook",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
|
|
|
@ -83,6 +83,7 @@ reqwest = { version = "0.11.16", features = ["blocking", "json"] }
|
|||
url = "2"
|
||||
|
||||
bytes = "1.4.0"
|
||||
signal-hook = "0.3.15"
|
||||
|
||||
[build-dependencies]
|
||||
shadow-rs = "0.17"
|
||||
|
|
|
@ -322,6 +322,12 @@ async fn main() -> Result<()> {
|
|||
Commands::Serve(args) => {
|
||||
info!("Starting UpEnd {}...", build::PKG_VERSION);
|
||||
|
||||
let term_now = Arc::new(std::sync::atomic::AtomicBool::new(false));
|
||||
for sig in signal_hook::consts::TERM_SIGNALS {
|
||||
signal_hook::flag::register_conditional_shutdown(*sig, 1, Arc::clone(&term_now))?;
|
||||
signal_hook::flag::register(*sig, Arc::clone(&term_now))?;
|
||||
}
|
||||
|
||||
let job_container = JobContainer::new();
|
||||
|
||||
let vault_path = args.directory;
|
||||
|
@ -446,7 +452,7 @@ async fn main() -> Result<()> {
|
|||
let _ = state.store.update(&upend, job_container.clone(), initial);
|
||||
let _ = extractors::extract_all(upend, state.store, job_container);
|
||||
Ok(())
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(feature = "desktop")]
|
||||
|
|
Loading…
Reference in New Issue