From c3e1c4e2f1c1b5da55470220cdffaa8c0f1b5dda Mon Sep 17 00:00:00 2001 From: Will Pragnell Date: Thu, 9 Jan 2025 21:56:21 -0800 Subject: [PATCH] termio/exec: use Command.wait rather than posix.waitpid --- src/termio/Exec.zig | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/termio/Exec.zig b/src/termio/Exec.zig index ca2bea6c9..415691a37 100644 --- a/src/termio/Exec.zig +++ b/src/termio/Exec.zig @@ -1297,13 +1297,10 @@ const Subprocess = struct { }, } - // See Command.zig wait for why we specify WNOHANG. - // The gist is that it lets us detect when children - // are still alive without blocking so that we can - // kill them again. - const res = posix.waitpid(pid, std.c.W.NOHANG); - log.debug("waitpid result={}", .{res.pid}); - if (res.pid != 0) break; + const ret = command.wait(false); + log.debug("wait result={}", .{ret}); + // 0 means the process is still running + if (ret != 0) break; std.time.sleep(10 * std.time.ns_per_ms); } },