diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-09-08 00:45:45 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-09-08 00:45:45 -0400 |
| commit | 838d52a8beaf1eaa9ca7efe1d586d1ad4925560e (patch) | |
| tree | 5d3e4edc713b22e5c16feca901edd86b52d26612 | |
| parent | a81e5161746b89e490bbf167489fd43a9d1821c2 (diff) | |
| download | zig-838d52a8beaf1eaa9ca7efe1d586d1ad4925560e.tar.gz zig-838d52a8beaf1eaa9ca7efe1d586d1ad4925560e.zip | |
std.os.ChildProcess: don't expect all SIGCHLD to come from spawn
| -rw-r--r-- | std/os/child_process.zig | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/std/os/child_process.zig b/std/os/child_process.zig index c02ffe8a7a..1ab1a9fa35 100644 --- a/std/os/child_process.zig +++ b/std/os/child_process.zig @@ -341,8 +341,11 @@ extern fn sigchld_handler(_: i32) { var status: i32 = undefined; const pid_result = posix.waitpid(-1, &status, posix.WNOHANG); const err = posix.getErrno(pid_result); - if (err == posix.ECHILD) { - return; + if (err > 0) { + if (err == posix.ECHILD) { + return; + } + unreachable; } handleTerm(i32(pid_result), status); } @@ -352,12 +355,10 @@ fn handleTerm(pid: i32, status: i32) { var it = children_nodes.first; while (it) |node| : (it = node.next) { if (node.data.pid == pid) { - assert(node.data.term == null); node.data.handleWaitResult(status); return; } } - unreachable; } const sigchld_set = { |
