aboutsummaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-02-09 00:24:23 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-02-09 00:24:23 -0500
commit32c988a2d7920fcd3da50a13a1ae9abcd57daf50 (patch)
tree68c847a2648eed20a70f1d2d01de795dfda98b0b /std
parent916d24cd2111559b0694d9579872832f4764a391 (diff)
downloadzig-32c988a2d7920fcd3da50a13a1ae9abcd57daf50.tar.gz
zig-32c988a2d7920fcd3da50a13a1ae9abcd57daf50.zip
fix build runner on windows
Diffstat (limited to 'std')
-rw-r--r--std/os/child_process.zig2
-rw-r--r--std/os/index.zig30
-rw-r--r--std/os/windows/util.zig8
3 files changed, 35 insertions, 5 deletions
diff --git a/std/os/child_process.zig b/std/os/child_process.zig
index 1b7639fb71..0b3040cdc9 100644
--- a/std/os/child_process.zig
+++ b/std/os/child_process.zig
@@ -160,7 +160,7 @@ pub const ChildProcess = struct {
else => os.unexpectedErrorWindows(err),
};
}
- self.waitUnwrappedWindows();
+ try self.waitUnwrappedWindows();
return ??self.term;
}
diff --git a/std/os/index.zig b/std/os/index.zig
index d8b2303981..a2da2ec673 100644
--- a/std/os/index.zig
+++ b/std/os/index.zig
@@ -38,6 +38,7 @@ pub const windowsLoadDll = windows_util.windowsLoadDll;
pub const windowsUnloadDll = windows_util.windowsUnloadDll;
pub const createWindowsEnvBlock = windows_util.createWindowsEnvBlock;
+pub const WindowsWaitError = windows_util.WaitError;
pub const WindowsOpenError = windows_util.OpenError;
pub const WindowsWriteError = windows_util.WriteError;
@@ -605,7 +606,9 @@ test "os.getCwd" {
_ = getCwd(debug.global_allocator);
}
-pub fn symLink(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) !void {
+pub const SymLinkError = PosixSymLinkError || WindowsSymLinkError;
+
+pub fn symLink(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) SymLinkError!void {
if (is_windows) {
return symLinkWindows(allocator, existing_path, new_path);
} else {
@@ -613,7 +616,12 @@ pub fn symLink(allocator: &Allocator, existing_path: []const u8, new_path: []con
}
}
-pub fn symLinkWindows(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) !void {
+pub const WindowsSymLinkError = error {
+ OutOfMemory,
+ Unexpected,
+};
+
+pub fn symLinkWindows(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) WindowsSymLinkError!void {
const existing_with_null = try cstr.addNullByte(allocator, existing_path);
defer allocator.free(existing_with_null);
const new_with_null = try cstr.addNullByte(allocator, new_path);
@@ -627,7 +635,23 @@ pub fn symLinkWindows(allocator: &Allocator, existing_path: []const u8, new_path
}
}
-pub fn symLinkPosix(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) !void {
+pub const PosixSymLinkError = error {
+ OutOfMemory,
+ AccessDenied,
+ DiskQuota,
+ PathAlreadyExists,
+ FileSystem,
+ SymLinkLoop,
+ NameTooLong,
+ FileNotFound,
+ SystemResources,
+ NoSpaceLeft,
+ ReadOnlyFileSystem,
+ NotDir,
+ Unexpected,
+};
+
+pub fn symLinkPosix(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) PosixSymLinkError!void {
const full_buf = try allocator.alloc(u8, existing_path.len + new_path.len + 2);
defer allocator.free(full_buf);
diff --git a/std/os/windows/util.zig b/std/os/windows/util.zig
index e2d7c14149..c19a5789e7 100644
--- a/std/os/windows/util.zig
+++ b/std/os/windows/util.zig
@@ -7,7 +7,13 @@ const mem = std.mem;
const BufMap = std.BufMap;
const cstr = std.cstr;
-pub fn windowsWaitSingle(handle: windows.HANDLE, milliseconds: windows.DWORD) !void {
+pub const WaitError = error {
+ WaitAbandoned,
+ WaitTimeOut,
+ Unexpected,
+};
+
+pub fn windowsWaitSingle(handle: windows.HANDLE, milliseconds: windows.DWORD) WaitError!void {
const result = windows.WaitForSingleObject(handle, milliseconds);
return switch (result) {
windows.WAIT_ABANDONED => error.WaitAbandoned,