From 46b5eb6ec3fed3c97512c05c13aa6f3dd9b71b87 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 27 Jan 2026 13:34:36 -0800 Subject: [PATCH] std.Io.Threaded: detect 0 byte successful reads according to ms docs this can happen with 0 byte writes to pipes. --- lib/std/Io/Threaded.zig | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig index bd6e4db4c2..3e67ade835 100644 --- a/lib/std/Io/Threaded.zig +++ b/lib/std/Io/Threaded.zig @@ -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; },