Skip to content

Commit 9208e41

Browse files
committed
Revert "Fix compile error"
This reverts commit f8f226f.
1 parent f8f226f commit 9208e41

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Sources/Subprocess/IO/AsyncIO+Windows.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ final class AsyncIO: @unchecked Sendable {
231231
// * ERROR_INVALID_PARAMETER - The handle likely doesn't have FILE_FLAG_OVERLAPPED, which might indicate that it isn't a pipe
232232
// so we can just signal that it is ready for reading right away.
233233
//
234-
continuation.yield(0)
234+
continuation.yield(UInt32.max)
235235
}
236236
}
237237
// Now save the continuation
@@ -322,15 +322,18 @@ final class AsyncIO: @unchecked Sendable {
322322

323323
}
324324

325-
// Depending on whether the handle is overlapped, or not find the bytes read
326-
// from the pointer, or the signal stream.
327325
let bytesRead =
328326
if bytesReadIfSynchronous == 0 {
329327
try await signalStream.next() ?? 0
330328
} else {
331329
bytesReadIfSynchronous
332330
}
333331

332+
// This handle doesn't support overlapped (asynchronous) I/O, so we must have read it synchronously above
333+
if bytesRead == UInt32.max {
334+
bytesRead = bytesReadIfSynchronous
335+
}
336+
334337
if bytesRead == 0 {
335338
// We reached EOF. Return whatever's left
336339
guard readLength > 0 else {

0 commit comments

Comments
 (0)