authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-12-22 02:33:39-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-12-22 02:33:39-05:00
logea805c5fe7a8e24597fcd59f064efc2a7dca3859
treec1c6a853df1f6786315a2f6b3fa0bfad44d246ad
parentd917815d8111b98dc237cbe2c723fa63018e02b1

fix darwin and windows from previous commit


3 files changed, 13 insertions(+), 11 deletions(-)

std/os/child_process.zig+8-6
...@@ -560,12 +560,14 @@ pub const ChildProcess = struct {...@@ -560,12 +560,14 @@ pub const ChildProcess = struct {
560560
561 // the cwd set in ChildProcess is in effect when choosing the executable path561 // the cwd set in ChildProcess is in effect when choosing the executable path
562 // to match posix semantics562 // to match posix semantics
563 const app_name = if (self.cwd) |cwd| x: {563 const app_name = x: {
564 const resolved = %return os.path.resolve(self.allocator, cwd, self.argv[0]);564 if (self.cwd) |cwd| {
565 defer self.allocator.free(resolved);565 const resolved = %return os.path.resolve(self.allocator, cwd, self.argv[0]);
566 break :x %return cstr.addNullByte(self.allocator, resolved);566 defer self.allocator.free(resolved);
567 } else x: {567 break :x %return cstr.addNullByte(self.allocator, resolved);
568 break :x %return cstr.addNullByte(self.allocator, self.argv[0]);568 } else {
569 break :x %return cstr.addNullByte(self.allocator, self.argv[0]);
570 }
569 };571 };
570 defer self.allocator.free(app_name);572 defer self.allocator.free(app_name);
571573
std/os/darwin.zig+2-2
...@@ -117,11 +117,11 @@ pub fn close(fd: i32) -> usize {...@@ -117,11 +117,11 @@ pub fn close(fd: i32) -> usize {
117}117}
118118
119pub fn abort() -> noreturn {119pub fn abort() -> noreturn {
120 return c.abort();120 c.abort();
121}121}
122122
123pub fn exit(code: i32) -> noreturn {123pub fn exit(code: i32) -> noreturn {
124 return c.exit(code);124 c.exit(code);
125}125}
126126
127pub fn isatty(fd: i32) -> bool {127pub fn isatty(fd: i32) -> bool {
std/os/windows/util.zig+3-3
...@@ -16,11 +16,11 @@ pub fn windowsWaitSingle(handle: windows.HANDLE, milliseconds: windows.DWORD) ->...@@ -16,11 +16,11 @@ pub fn windowsWaitSingle(handle: windows.HANDLE, milliseconds: windows.DWORD) ->
16 windows.WAIT_ABANDONED => error.WaitAbandoned,16 windows.WAIT_ABANDONED => error.WaitAbandoned,
17 windows.WAIT_OBJECT_0 => {},17 windows.WAIT_OBJECT_0 => {},
18 windows.WAIT_TIMEOUT => error.WaitTimeOut,18 windows.WAIT_TIMEOUT => error.WaitTimeOut,
19 windows.WAIT_FAILED => {19 windows.WAIT_FAILED => x: {
20 const err = windows.GetLastError();20 const err = windows.GetLastError();
21 switch (err) {21 break :x switch (err) {
22 else => os.unexpectedErrorWindows(err),22 else => os.unexpectedErrorWindows(err),
23 }23 };
24 },24 },
25 else => error.Unexpected,25 else => error.Unexpected,
26 };26 };