Skip to content

Commit

Permalink
process: call waitpid for kqueue to match pidfd behavior (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh authored Jan 24, 2025
2 parents aceef3d + b138093 commit 31eed4e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/watcher/process.zig
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ 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.
if (r.proc) |_| {
_ = posix.waitpid(c_inner.op.proc.pid, 0);
} else |_| {}

return @call(.always_inline, cb, .{
common.userdataValue(Userdata, ud),
l_inner,
Expand Down

0 comments on commit 31eed4e

Please sign in to comment.