Skip to content

Commit

Permalink
feat(rover-std): fs filewatcher now exits when file closed
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronArinder committed Sep 19, 2024
1 parent 90d4a74 commit d6c04ec
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/rover-std/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{
use crate::{errln, infoln, RoverStdError};
use anyhow::{anyhow, Context};
use camino::{ReadDirUtf8, Utf8Path, Utf8PathBuf};
use notify::event::ModifyKind;
use notify::event::{ModifyKind, RemoveKind};
use notify::{EventKind, RecursiveMode, Watcher};
use notify_debouncer_full::new_debouncer;
use tokio::sync::mpsc::UnboundedSender;
Expand Down Expand Up @@ -299,6 +299,12 @@ impl Fs {
break;
}
}

// Break out of the loop, what's being watched is now gone
if let EventKind::Remove(RemoveKind::Any) = event.kind {
errln!("Closing filewatcher");
return;
}
}
}
});
Expand Down

0 comments on commit d6c04ec

Please sign in to comment.