build runner: ignore ENOENT of fanotify_mark REMOVE

This happens when deleting watched directories and is harmless.
This commit is contained in:
Andrew Kelley
2024-07-10 00:41:35 -07:00
parent 2ebf021061
commit b6ed833083

View File

@@ -468,10 +468,13 @@ pub fn main() !void {
const path = w.dir_table.keys()[i];
try std.posix.fanotify_mark(w.fan_fd, .{
std.posix.fanotify_mark(w.fan_fd, .{
.REMOVE = true,
.ONLYDIR = true,
}, Watch.fan_mask, path.root_dir.handle.fd, path.subPathOrDot());
}, Watch.fan_mask, path.root_dir.handle.fd, path.subPathOrDot()) catch |err| switch (err) {
error.FileNotFound => {}, // Expected, harmless.
else => |e| std.log.warn("unable to unwatch '{}': {s}", .{ path, @errorName(e) }),
};
w.dir_table.swapRemoveAt(i);
w.handle_table.swapRemoveAt(i);