feat: add support for a background read thread in linux too

This commit is contained in:
CJ van den Berg 2026-03-08 09:49:03 +01:00
parent 1cbbdbd3cb
commit 5502f8940a
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
4 changed files with 87 additions and 20 deletions

View file

@ -21,7 +21,7 @@ const CliHandler = struct {
const vtable = nightwatch.Handler.VTable{
.change = change_cb,
.rename = rename_cb,
.wait_readable = if (builtin.os.tag == .linux) wait_readable_cb else {},
.wait_readable = if (nightwatch.linux_poll_mode) wait_readable_cb else {},
};
fn change_cb(h: *nightwatch.Handler, path: []const u8, event_type: nightwatch.EventType) error{HandlerFailed}!void {
@ -166,7 +166,7 @@ pub fn main() !void {
try stderr.interface.print("on watch: {s}\n", .{path});
}
if (builtin.os.tag == .linux) {
if (nightwatch.linux_poll_mode) {
try run_linux(&watcher);
} else if (builtin.os.tag == .windows) {
run_windows();