| ... | ... | @@ -170,7 +170,10 @@ pub async fn preadv(loop: *event.Loop, fd: os.FileHandle, data: []const []u8, of |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | pub async fn open( |
| 173 | | loop: *event.Loop, path: []const u8, flags: u32, mode: os.File.Mode, |
| 173 | loop: *event.Loop, |
| 174 | path: []const u8, |
| 175 | flags: u32, |
| 176 | mode: os.File.Mode, |
| 174 | 177 | ) os.File.OpenError!os.FileHandle { |
| 175 | 178 | // workaround for https://github.com/ziglang/zig/issues/1194 |
| 176 | 179 | suspend { |
| ... | ... | @@ -375,7 +378,7 @@ pub fn Watch(comptime V: type) type { |
| 375 | 378 | os_data: OsData, |
| 376 | 379 | |
| 377 | 380 | const OsData = switch (builtin.os) { |
| 378 | | builtin.Os.macosx => struct{ |
| 381 | builtin.Os.macosx => struct { |
| 379 | 382 | file_table: FileTable, |
| 380 | 383 | table_lock: event.Lock, |
| 381 | 384 | |
| ... | ... | @@ -477,11 +480,11 @@ pub fn Watch(comptime V: type) type { |
| 477 | 480 | var close_op_consumed = false; |
| 478 | 481 | defer if (!close_op_consumed) close_op.finish(); |
| 479 | 482 | |
| 480 | | const flags = posix.O_SYMLINK|posix.O_EVTONLY; |
| 483 | const flags = posix.O_SYMLINK | posix.O_EVTONLY; |
| 481 | 484 | const mode = 0; |
| 482 | 485 | const fd = try await (async open(self.channel.loop, resolved_path, flags, mode) catch unreachable); |
| 483 | 486 | close_op.setHandle(fd); |
| 484 | | |
| 487 | |
| 485 | 488 | var put_data: *OsData.Put = undefined; |
| 486 | 489 | const putter = try async self.kqPutEvents(close_op, value, &put_data); |
| 487 | 490 | close_op_consumed = true; |
| ... | ... | @@ -549,7 +552,10 @@ pub fn Watch(comptime V: type) type { |
| 549 | 552 | error.ProcessNotFound => unreachable, |
| 550 | 553 | error.AccessDenied, error.SystemResources => { |
| 551 | 554 | // TODO https://github.com/ziglang/zig/issues/769 |
| 552 | | const casted_err = @errSetCast(error{AccessDenied,SystemResources}, err); |
| 555 | const casted_err = @errSetCast(error{ |
| 556 | AccessDenied, |
| 557 | SystemResources, |
| 558 | }, err); |
| 553 | 559 | await (async self.channel.put(casted_err) catch unreachable); |
| 554 | 560 | }, |
| 555 | 561 | } |
| ... | ... | @@ -667,7 +673,10 @@ pub fn Watch(comptime V: type) type { |
| 667 | 673 | } |
| 668 | 674 | }; |
| 669 | 675 | if (user_value) |v| { |
| 670 | | await (async channel.put(Self.Event{ .CloseWrite = v }) catch unreachable); |
| 676 | await (async channel.put(Event{ |
| 677 | .id = WatchEventId.CloseWrite, |
| 678 | .data = v, |
| 679 | }) catch unreachable); |
| 671 | 680 | } |
| 672 | 681 | } |
| 673 | 682 | } |
| ... | ... | @@ -691,7 +700,7 @@ pub fn Watch(comptime V: type) type { |
| 691 | 700 | error.FileDescriptorIncompatibleWithEpoll => unreachable, |
| 692 | 701 | error.Unexpected => unreachable, |
| 693 | 702 | }; |
| 694 | | await (async channel.put(Self.Event{ .Err = transformed_err }) catch unreachable); |
| 703 | await (async channel.put(transformed_err) catch unreachable); |
| 695 | 704 | }; |
| 696 | 705 | }, |
| 697 | 706 | else => unreachable, |