fix darwin and windows from previous commit

master
Andrew Kelley 2017-12-22 02:33:39 -05:00
parent d917815d81
commit ea805c5fe7
3 changed files with 13 additions and 11 deletions

View File

@ -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);

View File

@ -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 {

View File

@ -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,
};