std.Io.Threaded: detect 0 byte successful reads

according to ms docs this can happen with 0 byte writes to pipes.
This commit is contained in:
Andrew Kelley
2026-01-27 13:34:36 -08:00
parent 1e188d790a
commit 46b5eb6ec3
+12 -1
View File
@@ -8249,7 +8249,18 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
null, // byte offset
null, // key
)) {
.SUCCESS, .END_OF_FILE, .PIPE_BROKEN => {
.SUCCESS => {
// Only END_OF_FILE is the true end.
if (io_status_block.Information == 0) {
try syscall.checkCancel();
continue;
} else {
syscall.finish();
io_status_block.u.Status = .SUCCESS;
return io_status_block.Information;
}
},
.END_OF_FILE, .PIPE_BROKEN => {
syscall.finish();
return io_status_block.Information;
},