fix: propagate watch errors from FSEvents.add_watch
This commit is contained in:
parent
3bb3def510
commit
e602a0638c
1 changed files with 2 additions and 2 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue