code: update os.waitpid usage for breaking change

This commit is contained in:
Isaac Freund 2020-10-22 18:20:09 +02:00
parent 3e4743e9a2
commit e179690a9c
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11
2 changed files with 5 additions and 5 deletions

View file

@ -242,8 +242,8 @@ fn layoutExternal(self: *Self, visible_count: u32) !void {
defer stdout.close(); defer stdout.close();
// TODO abort after a timeout // TODO abort after a timeout
const status = std.os.waitpid(pid, 0); const ret = std.os.waitpid(pid, 0);
if (!std.os.WIFEXITED(status) or std.os.WEXITSTATUS(status) != 0) if (!std.os.WIFEXITED(ret.status) or std.os.WEXITSTATUS(ret.status) != 0)
return LayoutError.BadExitCode; return LayoutError.BadExitCode;
const buffer = try stdout.inStream().readAllAlloc(&arena.allocator, 1024); const buffer = try stdout.inStream().readAllAlloc(&arena.allocator, 1024);

View file

@ -55,9 +55,9 @@ pub fn spawn(
} }
// Wait the intermediate child. // Wait the intermediate child.
const status = std.os.waitpid(pid, 0); const ret = std.os.waitpid(pid, 0);
if (!std.os.WIFEXITED(status) or if (!std.os.WIFEXITED(ret.status) or
(std.os.WIFEXITED(status) and std.os.WEXITSTATUS(status) != 0)) (std.os.WIFEXITED(ret.status) and std.os.WEXITSTATUS(ret.status) != 0))
{ {
out.* = try std.fmt.allocPrint(allocator, "fork/execve failed", .{}); out.* = try std.fmt.allocPrint(allocator, "fork/execve failed", .{});
return Error.Other; return Error.Other;