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>
This commit is contained in:
Julian Noble
2024-10-30 01:10:19 +11:00
committed by GitHub
parent b5cafe223a
commit a03ab9ee01

View File

@@ -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,