Commit a03ab9ee01

Julian Noble <julian@precisium.com.au>
2024-10-29 15:10:19
std.os.windows.WriteFile: Map ERROR_NO_DATA to error.BrokenPipe instead of ERROR_BROKEN_PIPE (#21811)
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 <alex@alexrp.com>
1 parent b5cafe2
Changed files (1)
lib
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,