authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-02 22:02:40-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-04 00:27:09-08:00
logb32a38ad2753df8df40008e279fb9f645de29c47
tree33dacb6e05d4944a61aa4af9900c5b78b746b1f9
parent1070c2a71a89175461273eba9f49bb85bdc83ecd

build: fix file system watching compilation on macOS


2 files changed, 12 insertions(+), 11 deletions(-)

lib/compiler/build_runner.zig+1-1
......@@ -544,7 +544,7 @@ pub fn main(init: process.Init.Minimal) !void {
544544 var w: Watch = w: {
545545 if (!watch) break :w undefined;
546546 if (!Watch.have_impl) fatal("--watch not yet implemented for {t}", .{builtin.os.tag});
547 break :w try .init();
547 break :w try .init(graph.cache.cwd);
548548 };
549549
550550 const now = Io.Clock.Timestamp.now(io, .awake) catch |err| fatal("failed to collect timestamp: {t}", .{err});
lib/std/Build/Watch.zig+11-10
......@@ -99,7 +99,8 @@ const Os = switch (builtin.os.tag) {
9999 };
100100 };
101101
102 fn init() !Watch {
102 fn init(cwd_path: []const u8) !Watch {
103 _ = cwd_path;
103104 return .{
104105 .dir_table = .{},
105106 .dir_count = 0,
......@@ -427,7 +428,8 @@ const Os = switch (builtin.os.tag) {
427428 }
428429 };
429430
430 fn init() !Watch {
431 fn init(cwd_path: []const u8) !Watch {
432 _ = cwd_path;
431433 return .{
432434 .dir_table = .{},
433435 .dir_count = 0,
......@@ -658,14 +660,13 @@ const Os = switch (builtin.os.tag) {
658660 const EV = std.c.EV;
659661 const NOTE = std.c.NOTE;
660662
661 fn init() !Watch {
662 const kq_fd = try posix.kqueue();
663 errdefer posix.close(kq_fd);
663 fn init(cwd_path: []const u8) !Watch {
664 _ = cwd_path;
664665 return .{
665666 .dir_table = .{},
666667 .dir_count = 0,
667668 .os = .{
668 .kq_fd = kq_fd,
669 .kq_fd = try posix.kqueue(),
669670 .handles = .empty,
670671 },
671672 .generation = 0,
......@@ -841,9 +842,9 @@ const Os = switch (builtin.os.tag) {
841842 .macos => struct {
842843 fse: FsEvents,
843844
844 fn init() !Watch {
845 fn init(cwd_path: []const u8) !Watch {
845846 return .{
846 .os = .{ .fse = try .init() },
847 .os = .{ .fse = try .init(cwd_path) },
847848 .dir_count = 0,
848849 .dir_table = undefined,
849850 .generation = undefined,
......@@ -863,8 +864,8 @@ const Os = switch (builtin.os.tag) {
863864 else => void,
864865};
865866
866pub fn init() !Watch {
867 return Os.init();
867pub fn init(cwd_path: []const u8) !Watch {
868 return Os.init(cwd_path);
868869}
869870
870871pub const Match = struct {