aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build
diff options
context:
space:
mode:
authorLee Cannon <leecannon@leecannon.xyz>2023-05-25 19:31:19 +0100
committerAndrew Kelley <andrew@ziglang.org>2023-06-13 11:27:45 -0700
commit21c258acac500a8fd35591514e4847ec489b8283 (patch)
tree20a989ebaa25763a21620e99692df8e0ab40eb7d /lib/std/Build
parentcc708b4a880e0077c3fb0a077a8a39104701dc9c (diff)
downloadzig-21c258acac500a8fd35591514e4847ec489b8283.tar.gz
zig-21c258acac500a8fd35591514e4847ec489b8283.zip
allow run step to skip foreign binary execution if executor fails
Diffstat (limited to 'lib/std/Build')
-rw-r--r--lib/std/Build/Step/Run.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/std/Build/Step/Run.zig b/lib/std/Build/Step/Run.zig
index ba2c084e24..fdb5b71c0a 100644
--- a/lib/std/Build/Step/Run.zig
+++ b/lib/std/Build/Step/Run.zig
@@ -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),
});