From 8f830207c47987de9767130d54abff79c8ec257d Mon Sep 17 00:00:00 2001 From: Jonathan Marler Date: Sun, 6 Feb 2022 06:05:40 -0700 Subject: [PATCH] fix bug I think I found while manually reviewing --- lib/std/child_process.zig | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/std/child_process.zig b/lib/std/child_process.zig index 3e12312d5d..4ccfcb4029 100644 --- a/lib/std/child_process.zig +++ b/lib/std/child_process.zig @@ -288,10 +288,8 @@ pub const ChildProcess = struct { else => |err| return windows.unexpectedError(err), } } - if (wait_object_count == 0) - return; - while (true) { + while (wait_object_count > 0) { const status = windows.kernel32.WaitForMultipleObjects(wait_object_count, &wait_objects, 0, windows.INFINITE); if (status == windows.WAIT_FAILED) { switch (windows.kernel32.GetLastError()) { @@ -315,11 +313,7 @@ pub const ChildProcess = struct { var read_bytes: u32 = undefined; if (windows.kernel32.GetOverlappedResult(handles[i], &overlapped[i], &read_bytes, 0) == 0) { switch (windows.kernel32.GetLastError()) { - .BROKEN_PIPE => { - if (wait_object_count == 0) - break; - continue; - }, + .BROKEN_PIPE => continue, else => |err| return windows.unexpectedError(err), } }