fix: propagate watch errors from FSEvents.add_watch

This commit is contained in:
CJ van den Berg 2026-03-14 14:20:05 +01:00
parent 3bb3def510
commit e602a0638c
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -221,13 +221,13 @@ fn callback(
} }
} }
pub fn add_watch(self: *@This(), allocator: std.mem.Allocator, path: []const u8) error{OutOfMemory}!void { pub fn add_watch(self: *@This(), allocator: std.mem.Allocator, path: []const u8) error{ WatchFailed, OutOfMemory }!void {
if (self.watches.contains(path)) return; if (self.watches.contains(path)) return;
const owned = try allocator.dupe(u8, path); const owned = try allocator.dupe(u8, path);
errdefer allocator.free(owned); errdefer allocator.free(owned);
try self.watches.put(allocator, owned, {}); try self.watches.put(allocator, owned, {});
self.stop_stream(allocator); self.stop_stream(allocator);
self.arm(allocator) catch {}; self.arm(allocator) catch return error.WatchFailed;
} }
pub fn remove_watch(self: *@This(), allocator: std.mem.Allocator, path: []const u8) void { pub fn remove_watch(self: *@This(), allocator: std.mem.Allocator, path: []const u8) void {