authorgravatar for johnnymarler@gmail.comJonathan Marler <johnnymarler@gmail.com> 2022-02-07 01:49:15-07:00
committergravatar for johnnymarler@gmail.comJonathan Marler <johnnymarler@gmail.com> 2022-02-07 01:49:15-07:00
log2cc33367ebee202462d6bef7f07120dd38ff6912
tree52823c74d01dc5a6933c97a3c11ea9156aa5dc2c
parent4fddb591e2377186ef942084cae2e93d5de448b3

fix bug when ReadFile returns synchronously in collectOutputWindows


1 files changed, 3 insertions(+), 1 deletions(-)

lib/std/child_process.zig+3-1
......@@ -270,12 +270,14 @@ pub const ChildProcess = struct {
270270 try buf.ensureTotalCapacity(new_capacity);
271271 const next_buf = buf.unusedCapacitySlice();
272272 if (next_buf.len == 0) return .full;
273 const read_result = windows.kernel32.ReadFile(handle, next_buf.ptr, math.cast(u32, next_buf.len) catch maxInt(u32), null, overlapped);
273 var read_bytes: u32 = undefined;
274 const read_result = windows.kernel32.ReadFile(handle, next_buf.ptr, math.cast(u32, next_buf.len) catch maxInt(u32), &read_bytes, overlapped);
274275 if (read_result == 0) return switch (windows.kernel32.GetLastError()) {
275276 .IO_PENDING => .pending,
276277 .BROKEN_PIPE => .closed,
277278 else => |err| windows.unexpectedError(err),
278279 };
280 buf.items.len += read_bytes;
279281 }
280282 }
281283