Skip to content

Commit

Permalink
fix(filewatcher): handle removed directories #8800
Browse files Browse the repository at this point in the history
When setting up manual recursive watching on folders (as is the case under Linux),
the watching thread should not exit if a directory no longer exists.
This is likely to occur within build output directories and it should
not be the cause for interrupting the daemon.
  • Loading branch information
krlvi committed Nov 7, 2024
1 parent b65ff15 commit 3d21e39
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions crates/turborepo-filewatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,17 @@ async fn watch_events(
if event.kind == EventKind::Create(CreateKind::Folder) {
for new_path in &event.paths {
if let Err(err) = manually_add_recursive_watches(new_path, &mut watcher, Some(&broadcast_sender)) {
warn!("encountered error watching filesystem {}", err);
break 'outer;
match err {
WatchError::WalkDir(_) => {
// Likely the path no longer exists
continue;
},
_ => {
warn!("encountered error watching filesystem {}", err);
break 'outer;
}

}
}
}
}
Expand Down

0 comments on commit 3d21e39

Please sign in to comment.