diff --git a/client/Cargo.toml b/client/Cargo.toml index 4608369e..a57e0670 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -44,4 +44,5 @@ features = [ "rt", "rt-multi-thread", "sync", + "signal", ] diff --git a/client/src/command/watch_store.rs b/client/src/command/watch_store.rs index 24eaf7a1..61e2d6cf 100644 --- a/client/src/command/watch_store.rs +++ b/client/src/command/watch_store.rs @@ -91,6 +91,14 @@ pub async fn run(opts: Opts) -> Result<()> { watcher.watch(&store_dir, RecursiveMode::NonRecursive)?; + tokio::spawn(async move { + tokio::signal::ctrl_c() + .await + .expect("Failed to listen for Ctrl-C"); + eprintln!("📶 Ctrl-C received. Exiting..."); + drop(watcher); + }); + eprintln!( "👀 Pushing new store paths to \"{cache}\" on \"{server}\"", cache = cache.as_str(),