File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,11 @@ where
147147 let _ = watcher. watch ( book. root . join ( "book.toml" ) , NonRecursive ) ;
148148
149149 for dir in & book. config . build . extra_watch_dirs {
150- let _ = watcher. watch ( dir, Recursive ) ;
150+ let path = dir. canonicalize ( ) . unwrap ( ) ;
151+ if let Err ( e) = watcher. watch ( & path, Recursive ) {
152+ error ! ( "Error while watching extra directory {path:?}:\n {e:?}" ) ;
153+ std:: process:: exit ( 1 ) ;
154+ }
151155 }
152156
153157 info ! ( "Listening for changes..." ) ;
@@ -170,7 +174,11 @@ where
170174 } )
171175 . collect :: < Vec < _ > > ( ) ;
172176
173- let paths = remove_ignored_files ( & book. root , & paths[ ..] ) ;
177+ // If we are watching files outside the current repository (via extra-watch-dirs), then they are definitionally
178+ // ignored by gitignore. So we handle this case by including such files into the watched paths list.
179+ let any_external_paths = paths. iter ( ) . filter ( |p| !p. starts_with ( & book. root ) ) . cloned ( ) ;
180+ let mut paths = remove_ignored_files ( & book. root , & paths[ ..] ) ;
181+ paths. extend ( any_external_paths) ;
174182
175183 if !paths. is_empty ( ) {
176184 closure ( paths, & book. root ) ;
You can’t perform that action at this time.
0 commit comments