diff options
| author | Cody Tapscott <topolarity@tapscott.me> | 2022-02-05 09:09:55 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-02-06 22:21:46 -0700 |
| commit | c1cf158729f4d726639a5695754957f9f45f89da (patch) | |
| tree | c876a91ac6f02f3e7bdc9097c742cd609a3b6014 /lib/std | |
| parent | 5065830aa007c374c382be9e80ba924df6cecc78 (diff) | |
| download | zig-c1cf158729f4d726639a5695754957f9f45f89da.tar.gz zig-c1cf158729f4d726639a5695754957f9f45f89da.zip | |
Replace argvCmd with std.mem.join
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/build/RunStep.zig | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/lib/std/build/RunStep.zig b/lib/std/build/RunStep.zig index 6bd1bda952..e8544921d9 100644 --- a/lib/std/build/RunStep.zig +++ b/lib/std/build/RunStep.zig @@ -138,17 +138,6 @@ pub fn setEnvironmentVariable(self: *RunStep, key: []const u8, value: []const u8 ) catch unreachable; } -fn argvCmd(allocator: Allocator, argv: []const []const u8) ![]u8 { - var cmd = std.ArrayList(u8).init(allocator); - defer cmd.deinit(); - for (argv[0 .. argv.len - 1]) |arg| { - try cmd.appendSlice(arg); - try cmd.append(' '); - } - try cmd.appendSlice(argv[argv.len - 1]); - return cmd.toOwnedSlice(); -} - pub fn expectStdErrEqual(self: *RunStep, bytes: []const u8) void { self.stderr_action = .{ .expect_exact = self.builder.dupe(bytes) }; } @@ -189,7 +178,7 @@ fn make(step: *Step) !void { const argv = argv_list.items; if (!std.process.can_spawn) { - const cmd = try argvCmd(self.builder.allocator, argv); + 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; |
