From 2c8ff1d47bab77295920cec7b0cb2d40257d2167 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 8 Sep 2017 01:23:48 -0400 Subject: [PATCH] std.ChildProcess.spawn: handle 0 from waitpid correctly --- std/os/child_process.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/std/os/child_process.zig b/std/os/child_process.zig index 1ab1a9fa35..3f3ddf03bf 100644 --- a/std/os/child_process.zig +++ b/std/os/child_process.zig @@ -340,6 +340,9 @@ extern fn sigchld_handler(_: i32) { while (true) { var status: i32 = undefined; const pid_result = posix.waitpid(-1, &status, posix.WNOHANG); + if (pid_result == 0) { + return; + } const err = posix.getErrno(pid_result); if (err > 0) { if (err == posix.ECHILD) {