From 15ef26f0a1f5aa71741cd001d43e2ad630c33008 Mon Sep 17 00:00:00 2001 From: Droid Date: Wed, 21 Jan 2026 15:14:09 +0400 Subject: [PATCH] fix: handle Ctrl+C setup failure gracefully --- src/watcher.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/watcher.rs b/src/watcher.rs index 816219f..c5bb857 100644 --- a/src/watcher.rs +++ b/src/watcher.rs @@ -59,10 +59,15 @@ impl FileWatcher { let running = Arc::new(AtomicBool::new(true)); let r = running.clone(); - ctrlc::set_handler(move || { + if let Err(e) = ctrlc::set_handler(move || { r.store(false, Ordering::SeqCst); - }) - .expect("Error setting Ctrl+C handler"); + }) { + eprintln!( + "{} Failed to set Ctrl+C handler: {}", + style("Warning:").yellow().bold(), + e + ); + } // Initial index println!(" {} Initial indexing...", style(">>").dim());