allow run step to skip foreign binary execution if executor fails

This commit is contained in:
Lee Cannon 2023-05-25 19:31:19 +01:00 committed by Andrew Kelley
parent cc708b4a88
commit 21c258acac

View File

@ -61,6 +61,13 @@ rename_step_with_output_arg: bool = true,
/// nothing.
skip_foreign_checks: bool = false,
/// If this is true, failing to execute a foreign binary will be considered an
/// error. However if this is false, the step will be skipped on failure instead.
///
/// This allows for a Run step to attempt to execute a foreign binary using an
/// external executor (such as qemu) but not fail if the executor is unavailable.
failing_to_execute_foreign_is_an_error: bool = true,
/// If stderr or stdout exceeds this amount, the child process is killed and
/// the step fails.
max_stdio_size: usize = 10 * 1024 * 1024,
@ -680,6 +687,8 @@ fn runCommand(
try Step.handleVerbose2(step.owner, self.cwd, self.env_map, interp_argv.items);
break :term spawnChildAndCollect(self, interp_argv.items, has_side_effects, prog_node) catch |e| {
if (!self.failing_to_execute_foreign_is_an_error) return error.MakeSkipped;
return step.fail("unable to spawn interpreter {s}: {s}", .{
interp_argv.items[0], @errorName(e),
});