Skip to content

Commit

Permalink
dont fatal in Watch.init, return error instead
Browse files Browse the repository at this point in the history
Fixes ziglang#21543.

Since UnsupportedFlags was caught explicitly, I replaced the fatal()
call with a std.log.err to maintain that behaviour. Returning an error
from init() will help clients fail gracefully, especially zls:
zigtools/zls#2041
  • Loading branch information
mocompute committed Oct 17, 2024
1 parent d38ed89 commit 9e7bbc3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/std/Build/Watch.zig
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,10 @@ pub fn init() !Watch {
.REPORT_FID = true,
.REPORT_TARGET_FID = true,
}, 0) catch |err| switch (err) {
error.UnsupportedFlags => fatal("fanotify_init failed due to old kernel; requires 5.17+", .{}),
error.UnsupportedFlags => |e| {
std.log.err("fanotify_init failed due to old kernel; requires 5.17+", .{});
return e;
},
else => |e| return e,
};
return .{
Expand Down

0 comments on commit 9e7bbc3

Please sign in to comment.