authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-27 13:34:36-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-27 15:32:34-08:00
log46b5eb6ec3fed3c97512c05c13aa6f3dd9b71b87
tree4ce8d654065b69f88f6cae207fe5cf244f932d5d
parent1e188d790a028117440369e9638a436c0daf1b68

std.Io.Threaded: detect 0 byte successful reads

according to ms docs this can happen with 0 byte writes to pipes.

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

lib/std/Io/Threaded.zig+12-1
......@@ -8249,7 +8249,18 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
82498249 null, // byte offset
82508250 null, // key
82518251 )) {
8252 .SUCCESS, .END_OF_FILE, .PIPE_BROKEN => {
8252 .SUCCESS => {
8253 // Only END_OF_FILE is the true end.
8254 if (io_status_block.Information == 0) {
8255 try syscall.checkCancel();
8256 continue;
8257 } else {
8258 syscall.finish();
8259 io_status_block.u.Status = .SUCCESS;
8260 return io_status_block.Information;
8261 }
8262 },
8263 .END_OF_FILE, .PIPE_BROKEN => {
82538264 syscall.finish();
82548265 return io_status_block.Information;
82558266 },