aboutsummaryrefslogtreecommitdiff
path: root/lib/std/build/RunStep.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-02-07 00:31:17 -0500
committerGitHub <noreply@github.com>2022-02-07 00:31:17 -0500
commit21135387fb7c2dbaf70a72f2c97341e9c1307045 (patch)
tree5926ea2d182a76f80429776a5473202738c9b656 /lib/std/build/RunStep.zig
parent069dd01ce4ced3cb9664e4f1e09be753cb3ed476 (diff)
parent33fa29601921d88097a1ee3c0d92b93047a5186d (diff)
downloadzig-21135387fb7c2dbaf70a72f2c97341e9c1307045.tar.gz
zig-21135387fb7c2dbaf70a72f2c97341e9c1307045.zip
Merge pull request #10782 from topolarity/gate-child-processes
Avoid depending on child process execution when not supported by host OS
Diffstat (limited to 'lib/std/build/RunStep.zig')
-rw-r--r--lib/std/build/RunStep.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/std/build/RunStep.zig b/lib/std/build/RunStep.zig
index 4e18d5d738..e8544921d9 100644
--- a/lib/std/build/RunStep.zig
+++ b/lib/std/build/RunStep.zig
@@ -10,6 +10,8 @@ const mem = std.mem;
const process = std.process;
const ArrayList = std.ArrayList;
const BufMap = std.BufMap;
+const Allocator = mem.Allocator;
+const ExecError = build.Builder.ExecError;
const max_stdout_size = 1 * 1024 * 1024; // 1 MiB
@@ -175,6 +177,13 @@ fn make(step: *Step) !void {
const argv = argv_list.items;
+ if (!std.process.can_spawn) {
+ const cmd = try std.mem.join(self.builder.allocator, " ", argv);
+ std.debug.print("the following command cannot be executed ({s} does not support spawning a child process):\n{s}", .{ @tagName(builtin.os.tag), cmd });
+ self.builder.allocator.free(cmd);
+ return ExecError.ExecNotSupported;
+ }
+
const child = std.ChildProcess.init(argv, self.builder.allocator) catch unreachable;
defer child.deinit();