Ignore 'historical' events from fs event stream

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2021-04-27 16:49:56 -07:00
parent 907b537a0b
commit c1d35b099b

View file

@ -148,16 +148,21 @@ impl EventStream {
let path_c_str = CStr::from_ptr(paths[p]);
let path = PathBuf::from(OsStr::from_bytes(path_c_str.to_bytes()));
if let Some(flag) = StreamFlags::from_bits(flags[p]) {
if flag.contains(StreamFlags::HISTORY_DONE) {
events.clear();
} else {
events.push(Event {
event_id: ids[p],
flags: flag,
path,
});
}
} else {
debug_assert!(false, "unknown flag set for fs event: {}", flags[p]);
}
}
if !events.is_empty() {
if !callback(events) {
fs::FSEventStreamStop(stream_ref);
cf::CFRunLoopStop(cf::CFRunLoopGetCurrent());
@ -165,6 +170,7 @@ impl EventStream {
}
}
}
}
impl Drop for Handle {
fn drop(&mut self) {