From a03ab9ee01129913af526a38b688313ccd83dca2 Mon Sep 17 00:00:00 2001 From: Julian Noble Date: Wed, 30 Oct 2024 01:10:19 +1100 Subject: [PATCH] std.os.windows.WriteFile: Map ERROR_NO_DATA to error.BrokenPipe instead of ERROR_BROKEN_PIPE (#21811) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It appears that ReadFile returns ERROR_BROKEN_PIPE for a broken pipe, but WriteFile returns ERROR_NO_DATA. Co-authored-by: Alex Rønne Petersen --- lib/std/os/windows.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index 7a460d5a9e..dbd6df46b7 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -682,7 +682,7 @@ pub fn WriteFile( .OPERATION_ABORTED => return error.OperationAborted, .NOT_ENOUGH_QUOTA => return error.SystemResources, .IO_PENDING => unreachable, - .BROKEN_PIPE => return error.BrokenPipe, + .NO_DATA => return error.BrokenPipe, .INVALID_HANDLE => return error.NotOpenForWriting, .LOCK_VIOLATION => return error.LockViolation, .NETNAME_DELETED => return error.ConnectionResetByPeer,