From 00a29bb6be6c5ad2c8aa469436471ff66de72c1b Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Wed, 19 Feb 2020 23:32:46 -0800 Subject: [PATCH] Unwatch paths when they're reported as removed --- vfs/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vfs/src/lib.rs b/vfs/src/lib.rs index c4423244..40b8979c 100644 --- a/vfs/src/lib.rs +++ b/vfs/src/lib.rs @@ -147,8 +147,14 @@ impl VfsLock { self.backend.event_receiver() } - pub fn commit_event(&mut self, _event: &VfsEvent) -> io::Result<()> { - // Because we hold no state, there's no cache to update here. + pub fn commit_event(&mut self, event: &VfsEvent) -> io::Result<()> { + match event { + VfsEvent::Remove(path) => { + let _ = self.backend.unwatch(&path); + } + _ => {} + } + Ok(()) } }