authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-10 23:02:04-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-11 06:22:05-04:00
loga82d7c20631b90de2f2298d351353041ac41650d
treeea10e8411448e594c15366657a7200e9b2bcb835
parent44a6172edbf6c99f4ebfeabb530756ed2a40c3c2

std: add missing error to windows.WriteFile

I encountered this error today when testing the self-hosted compiler on Windows.

4 files changed, 10 insertions(+), 0 deletions(-)

lib/std/os.zig+4
...@@ -953,6 +953,10 @@ pub const WriteError = error{...@@ -953,6 +953,10 @@ pub const WriteError = error{
953 OperationAborted,953 OperationAborted,
954 NotOpenForWriting,954 NotOpenForWriting,
955955
956 /// The process cannot access the file because another process has locked
957 /// a portion of the file. Windows-only.
958 LockViolation,
959
956 /// This error occurs when no global event loop is configured,960 /// This error occurs when no global event loop is configured,
957 /// and reading from the file descriptor would block.961 /// and reading from the file descriptor would block.
958 WouldBlock,962 WouldBlock,
lib/std/os/windows.zig+4
...@@ -517,6 +517,9 @@ pub const WriteFileError = error{...@@ -517,6 +517,9 @@ pub const WriteFileError = error{
517 OperationAborted,517 OperationAborted,
518 BrokenPipe,518 BrokenPipe,
519 NotOpenForWriting,519 NotOpenForWriting,
520 /// The process cannot access the file because another process has locked
521 /// a portion of the file.
522 LockViolation,
520 Unexpected,523 Unexpected,
521};524};
522525
...@@ -597,6 +600,7 @@ pub fn WriteFile(...@@ -597,6 +600,7 @@ pub fn WriteFile(
597 .IO_PENDING => unreachable,600 .IO_PENDING => unreachable,
598 .BROKEN_PIPE => return error.BrokenPipe,601 .BROKEN_PIPE => return error.BrokenPipe,
599 .INVALID_HANDLE => return error.NotOpenForWriting,602 .INVALID_HANDLE => return error.NotOpenForWriting,
603 .LOCK_VIOLATION => return error.LockViolation,
600 else => |err| return unexpectedError(err),604 else => |err| return unexpectedError(err),
601 }605 }
602 }606 }
src/link.zig+1
...@@ -435,6 +435,7 @@ pub const File = struct {...@@ -435,6 +435,7 @@ pub const File = struct {
435 EmitFail,435 EmitFail,
436 NameTooLong,436 NameTooLong,
437 CurrentWorkingDirectoryUnlinked,437 CurrentWorkingDirectoryUnlinked,
438 LockViolation,
438 };439 };
439440
440 /// Called from within the CodeGen to lower a local variable instantion as an unnamed441 /// Called from within the CodeGen to lower a local variable instantion as an unnamed
src/main.zig+1
...@@ -4227,6 +4227,7 @@ const FmtError = error{...@@ -4227,6 +4227,7 @@ const FmtError = error{
4227 NotOpenForWriting,4227 NotOpenForWriting,
4228 UnsupportedEncoding,4228 UnsupportedEncoding,
4229 ConnectionResetByPeer,4229 ConnectionResetByPeer,
4230 LockViolation,
4230} || fs.File.OpenError;4231} || fs.File.OpenError;
42314232
4232fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool, dir: fs.Dir, sub_path: []const u8) FmtError!void {4233fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool, dir: fs.Dir, sub_path: []const u8) FmtError!void {