| ... | @@ -2881,7 +2881,7 @@ fn runOrTest( | ... | @@ -2881,7 +2881,7 @@ fn runOrTest( |
| 2881 | // execv releases the locks; no need to destroy the Compilation here. | 2881 | // execv releases the locks; no need to destroy the Compilation here. |
| 2882 | const err = std.process.execv(gpa, argv.items); | 2882 | const err = std.process.execv(gpa, argv.items); |
| 2883 | try warnAboutForeignBinaries(gpa, arena, arg_mode, target_info, link_libc); | 2883 | try warnAboutForeignBinaries(gpa, arena, arg_mode, target_info, link_libc); |
| 2884 | const cmd = try argvCmd(arena, argv.items); | 2884 | const cmd = try std.mem.join(arena, " ", argv.items); |
| 2885 | fatal("the following command failed to execve with '{s}':\n{s}", .{ @errorName(err), cmd }); | 2885 | fatal("the following command failed to execve with '{s}':\n{s}", .{ @errorName(err), cmd }); |
| 2886 | } else if (std.process.can_spawn) { | 2886 | } else if (std.process.can_spawn) { |
| 2887 | const child = try std.ChildProcess.init(argv.items, gpa); | 2887 | const child = try std.ChildProcess.init(argv.items, gpa); |
| ... | @@ -2900,7 +2900,7 @@ fn runOrTest( | ... | @@ -2900,7 +2900,7 @@ fn runOrTest( |
| 2900 | | 2900 | |
| 2901 | const term = child.spawnAndWait() catch |err| { | 2901 | const term = child.spawnAndWait() catch |err| { |
| 2902 | try warnAboutForeignBinaries(gpa, arena, arg_mode, target_info, link_libc); | 2902 | try warnAboutForeignBinaries(gpa, arena, arg_mode, target_info, link_libc); |
| 2903 | const cmd = try argvCmd(arena, argv.items); | 2903 | const cmd = try std.mem.join(arena, " ", argv.items); |
| 2904 | fatal("the following command failed with '{s}':\n{s}", .{ @errorName(err), cmd }); | 2904 | fatal("the following command failed with '{s}':\n{s}", .{ @errorName(err), cmd }); |
| 2905 | }; | 2905 | }; |
| 2906 | switch (arg_mode) { | 2906 | switch (arg_mode) { |
| ... | @@ -2931,12 +2931,12 @@ fn runOrTest( | ... | @@ -2931,12 +2931,12 @@ fn runOrTest( |
| 2931 | if (code == 0) { | 2931 | if (code == 0) { |
| 2932 | if (!watch) return cleanExit(); | 2932 | if (!watch) return cleanExit(); |
| 2933 | } else { | 2933 | } else { |
| 2934 | const cmd = try argvCmd(arena, argv.items); | 2934 | const cmd = try std.mem.join(arena, " ", argv.items); |
| 2935 | fatal("the following test command failed with exit code {d}:\n{s}", .{ code, cmd }); | 2935 | fatal("the following test command failed with exit code {d}:\n{s}", .{ code, cmd }); |
| 2936 | } | 2936 | } |
| 2937 | }, | 2937 | }, |
| 2938 | else => { | 2938 | else => { |
| 2939 | const cmd = try argvCmd(arena, argv.items); | 2939 | const cmd = try std.mem.join(arena, " ", argv.items); |
| 2940 | fatal("the following test command crashed:\n{s}", .{cmd}); | 2940 | fatal("the following test command crashed:\n{s}", .{cmd}); |
| 2941 | }, | 2941 | }, |
| 2942 | } | 2942 | } |
| ... | @@ -2944,7 +2944,7 @@ fn runOrTest( | ... | @@ -2944,7 +2944,7 @@ fn runOrTest( |
| 2944 | else => unreachable, | 2944 | else => unreachable, |
| 2945 | } | 2945 | } |
| 2946 | } else { | 2946 | } else { |
| 2947 | const cmd = try argvCmd(arena, argv.items); | 2947 | const cmd = try std.mem.join(arena, " ", argv.items); |
| 2948 | fatal("the following command cannot be executed ({s} does not support spawning a child process):\n{s}", .{ @tagName(builtin.os.tag), cmd }); | 2948 | fatal("the following command cannot be executed ({s} does not support spawning a child process):\n{s}", .{ @tagName(builtin.os.tag), cmd }); |
| 2949 | } | 2949 | } |
| 2950 | } | 2950 | } |
| ... | @@ -3573,32 +3573,21 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi | ... | @@ -3573,32 +3573,21 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi |
| 3573 | if (prominent_compile_errors) { | 3573 | if (prominent_compile_errors) { |
| 3574 | fatal("the build command failed with exit code {d}", .{code}); | 3574 | fatal("the build command failed with exit code {d}", .{code}); |
| 3575 | } else { | 3575 | } else { |
| 3576 | const cmd = try argvCmd(arena, child_argv); | 3576 | const cmd = try std.mem.join(arena, " ", child_argv); |
| 3577 | fatal("the following build command failed with exit code {d}:\n{s}", .{ code, cmd }); | 3577 | fatal("the following build command failed with exit code {d}:\n{s}", .{ code, cmd }); |
| 3578 | } | 3578 | } |
| 3579 | }, | 3579 | }, |
| 3580 | else => { | 3580 | else => { |
| 3581 | const cmd = try argvCmd(arena, child_argv); | 3581 | const cmd = try std.mem.join(arena, " ", child_argv); |
| 3582 | fatal("the following build command crashed:\n{s}", .{cmd}); | 3582 | fatal("the following build command crashed:\n{s}", .{cmd}); |
| 3583 | }, | 3583 | }, |
| 3584 | } | 3584 | } |
| 3585 | } else { | 3585 | } else { |
| 3586 | const cmd = try argvCmd(arena, child_argv); | 3586 | const cmd = try std.mem.join(arena, " ", child_argv); |
| 3587 | fatal("the following command cannot be executed ({s} does not support spawning a child process):\n{s}", .{ @tagName(builtin.os.tag), cmd }); | 3587 | fatal("the following command cannot be executed ({s} does not support spawning a child process):\n{s}", .{ @tagName(builtin.os.tag), cmd }); |
| 3588 | } | 3588 | } |
| 3589 | } | 3589 | } |
| 3590 | | 3590 | |
| 3591 | fn argvCmd(allocator: Allocator, argv: []const []const u8) ![]u8 { | | |
| 3592 | var cmd = std.ArrayList(u8).init(allocator); | | |
| 3593 | defer cmd.deinit(); | | |
| 3594 | for (argv[0 .. argv.len - 1]) |arg| { | | |
| 3595 | try cmd.appendSlice(arg); | | |
| 3596 | try cmd.append(' '); | | |
| 3597 | } | | |
| 3598 | try cmd.appendSlice(argv[argv.len - 1]); | | |
| 3599 | return cmd.toOwnedSlice(); | | |
| 3600 | } | | |
| 3601 | | | |
| 3602 | fn readSourceFileToEndAlloc( | 3591 | fn readSourceFileToEndAlloc( |
| 3603 | allocator: mem.Allocator, | 3592 | allocator: mem.Allocator, |
| 3604 | input: *const fs.File, | 3593 | input: *const fs.File, |