From b4f3fd8a255d03bb4fe49d1c03f81fc0c59ab40e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 24 Jan 2025 10:14:25 -0800 Subject: [PATCH] process: call `waitpid` for kqueue to match pidfd behavior --- src/watcher/process.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/watcher/process.zig b/src/watcher/process.zig index 8112a50..eb4f39a 100644 --- a/src/watcher/process.zig +++ b/src/watcher/process.zig @@ -189,6 +189,12 @@ fn ProcessKqueue(comptime xev: type) type { c_inner: *xev.Completion, r: xev.Result, ) xev.CallbackAction { + // Reap the process. We do this because our xev.Process + // docs note that this is the equivalent of calling + // `wait` on a process. The Linux side (pidfd) does this + // automatically since the `waitid` syscall is used. + _ = posix.waitpid(c_inner.op.proc.pid, 0); + return @call(.always_inline, cb, .{ common.userdataValue(Userdata, ud), l_inner,