文件: core/watcher/file_watcher.rs:64-73 分类: 文件监控
core/watcher/file_watcher.rs:64-73
问题: Remove 事件在路径过滤之前就发送 FileEvent::Removed,其他事件都经过 event.paths 过滤。如果 notify 传递了非监控文件的事件,会误报文件删除。
Remove
FileEvent::Removed
event.paths
EventKind::Remove(_) => { let _ = tx.send(FileEvent::Removed); // ← 没检查路径! return; } // 路径过滤在后面 if !event.paths.iter().any(|p| p == &watch_path) { return; }
建议修复: 将路径过滤移到 match 之前,或对 Remove 事件也做路径检查。
已修复,commit 420b853。
修复方案:将路径过滤移至 event.kind 匹配之前,所有事件类型(包括 Remove)统一经过路径检查。
变更内容:
测试:7 个 watcher 测试全部通过,217 个项目测试全部通过。
No dependencies set.
The note is not visible to the blocked user.
文件:
core/watcher/file_watcher.rs:64-73分类: 文件监控
问题:
Remove事件在路径过滤之前就发送FileEvent::Removed,其他事件都经过event.paths过滤。如果 notify 传递了非监控文件的事件,会误报文件删除。建议修复: 将路径过滤移到 match 之前,或对 Remove 事件也做路径检查。
已修复,commit 420b853。
修复方案:将路径过滤移至 event.kind 匹配之前,所有事件类型(包括 Remove)统一经过路径检查。
变更内容:
测试:7 个 watcher 测试全部通过,217 个项目测试全部通过。