diff options
Diffstat (limited to 'std')
| -rw-r--r-- | std/os/child_process.zig | 14 | ||||
| -rw-r--r-- | std/os/darwin.zig | 4 | ||||
| -rw-r--r-- | std/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 index e719af65a8..6e86c99056 100644 --- 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 index f4166c2151..e230826b7e 100644 --- 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 index 0964adc16b..5b2dc1efb8 100644 --- 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, }; |
