Commit b6ed833083

Andrew Kelley <andrew@ziglang.org>
2024-07-10 09:41:35
build runner: ignore ENOENT of fanotify_mark REMOVE
This happens when deleting watched directories and is harmless.
1 parent 2ebf021
Changed files (1)
lib
lib/compiler/build_runner.zig
@@ -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);