authorgravatar for leecannon@leecannon.xyzLee Cannon <leecannon@leecannon.xyz> 2023-05-25 19:31:19+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-13 11:27:45-07:00
log21c258acac500a8fd35591514e4847ec489b8283
tree20a989ebaa25763a21620e99692df8e0ab40eb7d
parentcc708b4a880e0077c3fb0a077a8a39104701dc9c

allow run step to skip foreign binary execution if executor fails


1 files changed, 9 insertions(+), 0 deletions(-)

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