File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -231,7 +231,7 @@ final class AsyncIO: @unchecked Sendable {
231
231
// * ERROR_INVALID_PARAMETER - The handle likely doesn't have FILE_FLAG_OVERLAPPED, which might indicate that it isn't a pipe
232
232
// so we can just signal that it is ready for reading right away.
233
233
//
234
- continuation. yield ( 0 )
234
+ continuation. yield ( UInt32 . max )
235
235
}
236
236
}
237
237
// Now save the continuation
@@ -322,15 +322,18 @@ final class AsyncIO: @unchecked Sendable {
322
322
323
323
}
324
324
325
- // Depending on whether the handle is overlapped, or not find the bytes read
326
- // from the pointer, or the signal stream.
327
325
let bytesRead =
328
326
if bytesReadIfSynchronous == 0 {
329
327
try await signalStream. next ( ) ?? 0
330
328
} else {
331
329
bytesReadIfSynchronous
332
330
}
333
331
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
+
334
337
if bytesRead == 0 {
335
338
// We reached EOF. Return whatever's left
336
339
guard readLength > 0 else {
You can’t perform that action at this time.
0 commit comments