Skip to content

Commit 4614a36

Browse files
authoredJul 30, 2023
Merge pull request #2146 from riverbl/fix-extra-watch-dirs
Fix issues with extra-watch-dirs
2 parents d450544 + e00b883 commit 4614a36

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed
 

‎src/cmd/watch.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,16 @@ where
130130
let _ = watcher.watch(&book.root.join("book.toml"), NonRecursive);
131131

132132
for dir in &book.config.build.extra_watch_dirs {
133-
let path = dir.canonicalize().unwrap();
134-
if let Err(e) = watcher.watch(&path, Recursive) {
133+
let path = book.root.join(dir);
134+
let canonical_path = path.canonicalize().unwrap_or_else(|e| {
135+
error!("Error while watching extra directory {path:?}:\n {e}");
136+
std::process::exit(1);
137+
});
138+
139+
if let Err(e) = watcher.watch(&canonical_path, Recursive) {
135140
error!(
136141
"Error while watching extra directory {:?}:\n {:?}",
137-
path, e
142+
canonical_path, e
138143
);
139144
std::process::exit(1);
140145
}

0 commit comments

Comments
 (0)
Please sign in to comment.