From 136f1bfbd02d6c83c92b046e5151bc5572879ca4 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 21 Jan 2026 13:56:56 +0400 Subject: [PATCH] fix: gracefully handle permission errors in run_watch --- src/cli/commands.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/cli/commands.rs b/src/cli/commands.rs index f128499..d03e93d 100644 --- a/src/cli/commands.rs +++ b/src/cli/commands.rs @@ -744,6 +744,18 @@ fn run_watch(config: &Config, path: PathBuf) -> Result<()> { } } + // Check if path exists and has valid permissions + if !path.exists() { + use anyhow::bail; + bail!("Path does not exist: {}", path.display()); + } + + // Try to access the directory to check permissions + if let Err(e) = std::fs::read_dir(&path) { + use anyhow::bail; + bail!("Failed to access directory '{}': {}. Check permissions.", path.display(), e); + } + let watcher = FileWatcher::new(config.clone(), path); watcher.watch() }