authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-10 00:41:35-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-12 00:14:08-07:00
logb6ed833083e5174d7b616de7c9205596d1aa0a9f
tree9693714963ccce1f128c705e10fb53ee3e21d61b
parent2ebf021061b8789226fa8bafe36f7827925d7022

build runner: ignore ENOENT of fanotify_mark REMOVE

This happens when deleting watched directories and is harmless.

1 files changed, 5 insertions(+), 2 deletions(-)

lib/compiler/build_runner.zig+5-2
...@@ -468,10 +468,13 @@ pub fn main() !void {...@@ -468,10 +468,13 @@ pub fn main() !void {
468468
469 const path = w.dir_table.keys()[i];469 const path = w.dir_table.keys()[i];
470470
471 try std.posix.fanotify_mark(w.fan_fd, .{471 std.posix.fanotify_mark(w.fan_fd, .{
472 .REMOVE = true,472 .REMOVE = true,
473 .ONLYDIR = true,473 .ONLYDIR = true,
474 }, Watch.fan_mask, path.root_dir.handle.fd, path.subPathOrDot());474 }, Watch.fan_mask, path.root_dir.handle.fd, path.subPathOrDot()) catch |err| switch (err) {
475 error.FileNotFound => {}, // Expected, harmless.
476 else => |e| std.log.warn("unable to unwatch '{}': {s}", .{ path, @errorName(e) }),
477 };
475478
476 w.dir_table.swapRemoveAt(i);479 w.dir_table.swapRemoveAt(i);
477 w.handle_table.swapRemoveAt(i);480 w.handle_table.swapRemoveAt(i);