diff options
| author | Lee Cannon <leecannon@leecannon.xyz> | 2023-05-25 19:31:19 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-13 11:27:45 -0700 |
| commit | 21c258acac500a8fd35591514e4847ec489b8283 (patch) | |
| tree | 20a989ebaa25763a21620e99692df8e0ab40eb7d /lib/std/Build | |
| parent | cc708b4a880e0077c3fb0a077a8a39104701dc9c (diff) | |
| download | zig-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.zig | 9 |
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), }); |
