From 9e7bbc339bcce9218ac72e2bc65c0f14e9090efc Mon Sep 17 00:00:00 2001 From: mo Date: Sun, 29 Sep 2024 22:44:07 +1300 Subject: [PATCH] dont fatal in Watch.init, return error instead Fixes #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: https://github.com/zigtools/zls/pull/2041 --- lib/std/Build/Watch.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/std/Build/Watch.zig b/lib/std/Build/Watch.zig index c8f6c0d64f73..d1907532588e 100644 --- a/lib/std/Build/Watch.zig +++ b/lib/std/Build/Watch.zig @@ -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 .{