Populates s.result_failed_command unconditionally.
pub fn captureChildProcess(
s: *Step,
maker: *Maker,
allocator: Allocator,
options: CaptureChildProcessOptions,
) !std.process.RunResult
pub fn captureChildProcess(
s: *Step,
maker: *Maker,
allocator: Allocator,
options: CaptureChildProcessOptions,
) !std.process.RunResult {
const gpa = maker.gpa;
const graph = maker.graph;
const io = graph.io;
s.setFailedCommand(gpa, options.argv, .{});
try handleChildProcUnsupported(s, maker);
try graph.handleVerbose(null, null, options.argv);
const result = std.process.run(allocator, io, .{
.argv = options.argv,
.environ_map = options.environ_map orelse &graph.environ_map,
.progress_node = options.progress_node,
}) catch |err| {
switch (err) {
error.OutOfMemory, error.Canceled => |e| return e,
error.FileNotFound => |e| if (options.allow_failure) return e,
else => {},
}
return s.fail(maker, "failed to run {s}: {t}", .{ options.argv[0], err });
};
if (result.stderr.len > 0) try s.result_error_msgs.append(graph.arena, result.stderr);
return result;
}