Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PipeNotAvailable error #21938

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/std/fs.zig
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ pub const SelfExePathError = error{
DeviceBusy,
SharingViolation,
PipeBusy,
PipeNotAvailable,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we'd prefer PipeUnavailable? Not sure if we have any real naming convention for stuff like this.

NotLink,
PathAlreadyExists,

Expand Down
1 change: 1 addition & 0 deletions lib/std/fs/File.zig
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub const OpenError = error{
FileNotFound,
AccessDenied,
PipeBusy,
PipeNotAvailable,
NameTooLong,
/// WASI-only; file paths must be valid UTF-8.
InvalidUtf8,
Expand Down
4 changes: 4 additions & 0 deletions lib/std/os/windows.zig
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub const OpenError = error{
NoDevice,
AccessDenied,
PipeBusy,
PipeNotAvailable,
PathAlreadyExists,
Unexpected,
NameTooLong,
Expand Down Expand Up @@ -132,6 +133,7 @@ pub fn OpenFile(sub_path_w: []const u16, options: OpenFileOptions) OpenError!HAN
.SHARING_VIOLATION => return error.AccessDenied,
.ACCESS_DENIED => return error.AccessDenied,
.PIPE_BUSY => return error.PipeBusy,
.PIPE_NOT_AVAILABLE => return error.PipeNotAvailable,
.OBJECT_PATH_SYNTAX_BAD => unreachable,
.OBJECT_NAME_COLLISION => return error.PathAlreadyExists,
.FILE_IS_A_DIRECTORY => return error.IsDir,
Expand Down Expand Up @@ -801,6 +803,7 @@ pub fn CreateSymbolicLink(
error.NotDir => return error.Unexpected,
error.WouldBlock => return error.Unexpected,
error.PipeBusy => return error.Unexpected,
error.PipeNotAvailable => return error.Unexpected,
error.AntivirusInterference => return error.Unexpected,
else => |e| return e,
};
Expand Down Expand Up @@ -1335,6 +1338,7 @@ pub fn GetFinalPathNameByHandle(
error.NoDevice => return error.Unexpected,
error.AccessDenied => return error.Unexpected,
error.PipeBusy => return error.Unexpected,
error.PipeNotAvailable => return error.Unexpected,
error.PathAlreadyExists => return error.Unexpected,
error.WouldBlock => return error.Unexpected,
error.NetworkNotFound => return error.Unexpected,
Expand Down
4 changes: 4 additions & 0 deletions lib/std/posix.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2574,6 +2574,7 @@ pub const RenameError = error{
NoDevice,
SharingViolation,
PipeBusy,
PipeNotAvailable,
/// On Windows, `\\server` or `\\server\share` was not found.
NetworkNotFound,
/// On Windows, antivirus software is enabled by default. It can be
Expand Down Expand Up @@ -2945,6 +2946,7 @@ pub fn mkdiratW(dir_fd: fd_t, sub_path_w: []const u16, mode: u32) MakeDirError!v
}) catch |err| switch (err) {
error.IsDir => return error.Unexpected,
error.PipeBusy => return error.Unexpected,
error.PipeNotAvailable => return error.Unexpected,
error.WouldBlock => return error.Unexpected,
error.AntivirusInterference => return error.Unexpected,
else => |e| return e,
Expand Down Expand Up @@ -3039,6 +3041,7 @@ pub fn mkdirW(dir_path_w: []const u16, mode: u32) MakeDirError!void {
}) catch |err| switch (err) {
error.IsDir => return error.Unexpected,
error.PipeBusy => return error.Unexpected,
error.PipeNotAvailable => return error.Unexpected,
error.WouldBlock => return error.Unexpected,
error.AntivirusInterference => return error.Unexpected,
else => |e| return e,
Expand Down Expand Up @@ -5368,6 +5371,7 @@ pub const RealPathError = error{

SharingViolation,
PipeBusy,
PipeNotAvailable,

/// Windows-only; file paths provided by the user must be valid WTF-8.
/// https://simonsapin.github.io/wtf-8/
Expand Down
1 change: 1 addition & 0 deletions lib/std/process/Child.zig
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ fn spawnWindows(self: *ChildProcess) SpawnError!void {
}) catch |err| switch (err) {
error.PathAlreadyExists => return error.Unexpected, // not possible for "NUL"
error.PipeBusy => return error.Unexpected, // not possible for "NUL"
error.PipeNotAvailable => return error.Unexpected, // not possible for "NUL"
error.FileNotFound => return error.Unexpected, // not possible for "NUL"
error.AccessDenied => return error.Unexpected, // not possible for "NUL"
error.NameTooLong => return error.Unexpected, // not possible for "NUL"
Expand Down
2 changes: 2 additions & 0 deletions lib/std/zig/system.zig
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ fn glibcVerFromRPath(rpath: []const u8) !std.SemanticVersion {
error.InvalidWtf8 => unreachable, // Windows only
error.BadPathName => unreachable, // Windows only
error.PipeBusy => unreachable, // Windows-only
error.PipeNotAvailable => unreachable, // Windows-only
error.SharingViolation => unreachable, // Windows-only
error.NetworkNotFound => unreachable, // Windows-only
error.AntivirusInterference => unreachable, // Windows-only
Expand Down Expand Up @@ -1068,6 +1069,7 @@ fn detectAbiAndDynamicLinker(
error.InvalidWtf8 => unreachable, // Windows only
error.BadPathName => unreachable,
error.PipeBusy => unreachable,
error.PipeNotAvailable => unreachable,
error.FileLocksNotSupported => unreachable,
error.WouldBlock => unreachable,
error.FileBusy => unreachable, // opened without write permissions
Expand Down
1 change: 1 addition & 0 deletions src/Builtin.zig
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ pub fn populateFile(comp: *Compilation, mod: *Module, file: *File) !void {
error.BadPathName => unreachable, // it's always "builtin.zig"
error.NameTooLong => unreachable, // it's always "builtin.zig"
error.PipeBusy => unreachable, // it's not a pipe
error.PipeNotAvailable => unreachable, // it's not a pipe
error.WouldBlock => unreachable, // not asking for non-blocking I/O

error.FileNotFound => try writeFile(file, mod),
Expand Down
1 change: 1 addition & 0 deletions src/Zcu/PerThread.zig
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ pub fn astGenFile(
error.BadPathName => unreachable, // it's a hex encoded name
error.NameTooLong => unreachable, // it's a fixed size name
error.PipeBusy => unreachable, // it's not a pipe
error.PipeNotAvailable => unreachable, // it's not a pipe
error.WouldBlock => unreachable, // not asking for non-blocking I/O
// There are no dir components, so you would think that this was
// unreachable, however we have observed on macOS two processes racing
Expand Down
Loading