zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit ea805c5fe7a8e24597fcd59f064efc2a7dca3859 (tree)
parent d917815d8111b98dc237cbe2c723fa63018e02b1
Author: Andrew Kelley <superjoe30@gmail.com>
Date:   Fri, 22 Dec 2017 02:33:39 -0500

fix darwin and windows from previous commit

Diffstat:
Mstd/os/child_process.zig | 14++++++++------
Mstd/os/darwin.zig | 4++--
Mstd/os/windows/util.zig | 6+++---
3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/std/os/child_process.zig b/std/os/child_process.zig @@ -560,12 +560,14 @@ pub const ChildProcess = struct { // the cwd set in ChildProcess is in effect when choosing the executable path // to match posix semantics - const app_name = if (self.cwd) |cwd| x: { - const resolved = %return os.path.resolve(self.allocator, cwd, self.argv[0]); - defer self.allocator.free(resolved); - break :x %return cstr.addNullByte(self.allocator, resolved); - } else x: { - break :x %return cstr.addNullByte(self.allocator, self.argv[0]); + const app_name = x: { + if (self.cwd) |cwd| { + const resolved = %return os.path.resolve(self.allocator, cwd, self.argv[0]); + defer self.allocator.free(resolved); + break :x %return cstr.addNullByte(self.allocator, resolved); + } else { + break :x %return cstr.addNullByte(self.allocator, self.argv[0]); + } }; defer self.allocator.free(app_name); diff --git a/std/os/darwin.zig b/std/os/darwin.zig @@ -117,11 +117,11 @@ pub fn close(fd: i32) -> usize { } pub fn abort() -> noreturn { - return c.abort(); + c.abort(); } pub fn exit(code: i32) -> noreturn { - return c.exit(code); + c.exit(code); } pub fn isatty(fd: i32) -> bool { diff --git a/std/os/windows/util.zig b/std/os/windows/util.zig @@ -16,11 +16,11 @@ pub fn windowsWaitSingle(handle: windows.HANDLE, milliseconds: windows.DWORD) -> windows.WAIT_ABANDONED => error.WaitAbandoned, windows.WAIT_OBJECT_0 => {}, windows.WAIT_TIMEOUT => error.WaitTimeOut, - windows.WAIT_FAILED => { + windows.WAIT_FAILED => x: { const err = windows.GetLastError(); - switch (err) { + break :x switch (err) { else => os.unexpectedErrorWindows(err), - } + }; }, else => error.Unexpected, };