| ... | ... | @@ -277,10 +277,19 @@ pub const ChildProcess = struct { |
| 277 | 277 | const new_capacity = std.math.min(outs[i].items.len + bump_amt, max_output_bytes); |
| 278 | 278 | try outs[i].ensureTotalCapacity(new_capacity); |
| 279 | 279 | const buf = outs[i].unusedCapacitySlice(); |
| 280 | | _ = windows.kernel32.ReadFile(handles[i], buf.ptr, math.cast(u32, buf.len) catch maxInt(u32), null, &overlapped[i]); |
| 281 | | wait_objects[wait_object_count] = handles[i]; |
| 282 | | wait_object_count += 1; |
| 280 | const read_result = windows.kernel32.ReadFile(handles[i], buf.ptr, math.cast(u32, buf.len) catch maxInt(u32), null, &overlapped[i]); |
| 281 | std.debug.assert(read_result == 0); |
| 282 | switch (windows.kernel32.GetLastError()) { |
| 283 | .IO_PENDING => { |
| 284 | wait_objects[wait_object_count] = handles[i]; |
| 285 | wait_object_count += 1; |
| 286 | }, |
| 287 | .BROKEN_PIPE => {}, // don't add to the wait_objects list |
| 288 | else => |err| return windows.unexpectedError(err), |
| 289 | } |
| 283 | 290 | } |
| 291 | if (wait_object_count == 0) |
| 292 | return; |
| 284 | 293 | |
| 285 | 294 | while (true) { |
| 286 | 295 | const status = windows.kernel32.WaitForMultipleObjects(wait_object_count, &wait_objects, 0, windows.INFINITE); |
| ... | ... | @@ -320,9 +329,16 @@ pub const ChildProcess = struct { |
| 320 | 329 | try outs[i].ensureTotalCapacity(new_capacity); |
| 321 | 330 | const buf = outs[i].unusedCapacitySlice(); |
| 322 | 331 | if (buf.len == 0) return if (i == 0) error.StdoutStreamTooLong else error.StderrStreamTooLong; |
| 323 | | _ = windows.kernel32.ReadFile(handles[i], buf.ptr, math.cast(u32, buf.len) catch maxInt(u32), null, &overlapped[i]); |
| 324 | | wait_objects[wait_object_count] = handles[i]; |
| 325 | | wait_object_count += 1; |
| 332 | const read_result = windows.kernel32.ReadFile(handles[i], buf.ptr, math.cast(u32, buf.len) catch maxInt(u32), null, &overlapped[i]); |
| 333 | std.debug.assert(read_result == 0); |
| 334 | switch (windows.kernel32.GetLastError()) { |
| 335 | .IO_PENDING => { |
| 336 | wait_objects[wait_object_count] = handles[i]; |
| 337 | wait_object_count += 1; |
| 338 | }, |
| 339 | .BROKEN_PIPE => {}, // don't add to the wait_objects list |
| 340 | else => |err| return windows.unexpectedError(err), |
| 341 | } |
| 326 | 342 | } |
| 327 | 343 | } |
| 328 | 344 | |