build: fix file system watching compilation on macOS

This commit is contained in:
Andrew Kelley
2026-01-02 22:02:40 -08:00
parent 1070c2a71a
commit b32a38ad27
2 changed files with 12 additions and 11 deletions
+1 -1
View File
@@ -544,7 +544,7 @@ pub fn main(init: process.Init.Minimal) !void {
var w: Watch = w: {
if (!watch) break :w undefined;
if (!Watch.have_impl) fatal("--watch not yet implemented for {t}", .{builtin.os.tag});
break :w try .init();
break :w try .init(graph.cache.cwd);
};
const now = Io.Clock.Timestamp.now(io, .awake) catch |err| fatal("failed to collect timestamp: {t}", .{err});
+11 -10
View File
@@ -99,7 +99,8 @@ const Os = switch (builtin.os.tag) {
};
};
fn init() !Watch {
fn init(cwd_path: []const u8) !Watch {
_ = cwd_path;
return .{
.dir_table = .{},
.dir_count = 0,
@@ -427,7 +428,8 @@ const Os = switch (builtin.os.tag) {
}
};
fn init() !Watch {
fn init(cwd_path: []const u8) !Watch {
_ = cwd_path;
return .{
.dir_table = .{},
.dir_count = 0,
@@ -658,14 +660,13 @@ const Os = switch (builtin.os.tag) {
const EV = std.c.EV;
const NOTE = std.c.NOTE;
fn init() !Watch {
const kq_fd = try posix.kqueue();
errdefer posix.close(kq_fd);
fn init(cwd_path: []const u8) !Watch {
_ = cwd_path;
return .{
.dir_table = .{},
.dir_count = 0,
.os = .{
.kq_fd = kq_fd,
.kq_fd = try posix.kqueue(),
.handles = .empty,
},
.generation = 0,
@@ -841,9 +842,9 @@ const Os = switch (builtin.os.tag) {
.macos => struct {
fse: FsEvents,
fn init() !Watch {
fn init(cwd_path: []const u8) !Watch {
return .{
.os = .{ .fse = try .init() },
.os = .{ .fse = try .init(cwd_path) },
.dir_count = 0,
.dir_table = undefined,
.generation = undefined,
@@ -863,8 +864,8 @@ const Os = switch (builtin.os.tag) {
else => void,
};
pub fn init() !Watch {
return Os.init();
pub fn init(cwd_path: []const u8) !Watch {
return Os.init(cwd_path);
}
pub const Match = struct {