| ... | @@ -29,8 +29,10 @@ fn logImpl( | ... | @@ -29,8 +29,10 @@ fn logImpl( |
| 29 | | 29 | |
| 30 | pub fn main(init: std.process.Init) !void { | 30 | pub fn main(init: std.process.Init) !void { |
| 31 | const fatal = std.process.fatal; | 31 | const fatal = std.process.fatal; |
| 32 | const arena = init.arena; | 32 | const arena = init.arena.allocator(); |
| 33 | const io = init.io; | 33 | const io = init.io; |
| | 34 | const env_map = init.env_map; |
| | 35 | const cwd_path = try std.process.getCwdAlloc(arena); |
| 34 | | 36 | |
| 35 | var opt_zig_exe: ?[]const u8 = null; | 37 | var opt_zig_exe: ?[]const u8 = null; |
| 36 | var opt_input_file_name: ?[]const u8 = null; | 38 | var opt_input_file_name: ?[]const u8 = null; |
| ... | @@ -44,7 +46,7 @@ pub fn main(init: std.process.Init) !void { | ... | @@ -44,7 +46,7 @@ pub fn main(init: std.process.Init) !void { |
| 44 | | 46 | |
| 45 | var debug_log_args: std.ArrayList([]const u8) = .empty; | 47 | var debug_log_args: std.ArrayList([]const u8) = .empty; |
| 46 | | 48 | |
| 47 | var arg_it = try init.minimal.argsIterator(arena); | 49 | var arg_it = try init.minimal.args.iterateAllocator(arena); |
| 48 | _ = arg_it.skip(); | 50 | _ = arg_it.skip(); |
| 49 | while (arg_it.next()) |arg| { | 51 | while (arg_it.next()) |arg| { |
| 50 | if (arg.len > 0 and arg[0] == '-') { | 52 | if (arg.len > 0 and arg[0] == '-') { |
| ... | @@ -111,9 +113,9 @@ pub fn main(init: std.process.Init) !void { | ... | @@ -111,9 +113,9 @@ pub fn main(init: std.process.Init) !void { |
| 111 | } | 113 | } |
| 112 | | 114 | |
| 113 | // Convert paths to be relative to the cwd of the subprocess. | 115 | // Convert paths to be relative to the cwd of the subprocess. |
| 114 | const resolved_zig_exe = try Dir.path.relative(arena, tmp_dir_path, zig_exe); | 116 | const resolved_zig_exe = try Dir.path.relative(arena, cwd_path, env_map, tmp_dir_path, zig_exe); |
| 115 | const opt_resolved_lib_dir = if (opt_lib_dir) |lib_dir| | 117 | const opt_resolved_lib_dir = if (opt_lib_dir) |lib_dir| |
| 116 | try Dir.path.relative(arena, tmp_dir_path, lib_dir) | 118 | try Dir.path.relative(arena, cwd_path, env_map, tmp_dir_path, lib_dir) |
| 117 | else | 119 | else |
| 118 | null; | 120 | null; |
| 119 | | 121 | |
| ... | @@ -174,7 +176,7 @@ pub fn main(init: std.process.Init) !void { | ... | @@ -174,7 +176,7 @@ pub fn main(init: std.process.Init) !void { |
| 174 | var cc_child_args: std.ArrayList([]const u8) = .empty; | 176 | var cc_child_args: std.ArrayList([]const u8) = .empty; |
| 175 | if (target.backend == .cbe) { | 177 | if (target.backend == .cbe) { |
| 176 | const resolved_cc_zig_exe = if (opt_cc_zig) |cc_zig_exe| | 178 | const resolved_cc_zig_exe = if (opt_cc_zig) |cc_zig_exe| |
| 177 | try Dir.path.relative(arena, tmp_dir_path, cc_zig_exe) | 179 | try Dir.path.relative(arena, cwd_path, env_map, tmp_dir_path, cc_zig_exe) |
| 178 | else | 180 | else |
| 179 | resolved_zig_exe; | 181 | resolved_zig_exe; |
| 180 | | 182 | |
| ... | @@ -193,7 +195,7 @@ pub fn main(init: std.process.Init) !void { | ... | @@ -193,7 +195,7 @@ pub fn main(init: std.process.Init) !void { |
| 193 | try cc_child_args.append(arena, "-o"); | 195 | try cc_child_args.append(arena, "-o"); |
| 194 | } | 196 | } |
| 195 | | 197 | |
| 196 | var child = std.process.spawn(io, .{ | 198 | var child = try std.process.spawn(io, .{ |
| 197 | .argv = child_args.items, | 199 | .argv = child_args.items, |
| 198 | .stdin = .pipe, | 200 | .stdin = .pipe, |
| 199 | .stdout = .pipe, | 201 | .stdout = .pipe, |
| ... | @@ -644,7 +646,7 @@ const Eval = struct { | ... | @@ -644,7 +646,7 @@ const Eval = struct { |
| 644 | eval.tmp_dir.close(io); | 646 | eval.tmp_dir.close(io); |
| 645 | if (!eval.preserve_tmp_on_fatal) { | 647 | if (!eval.preserve_tmp_on_fatal) { |
| 646 | // Kill the child since it holds an open handle to its CWD which is the tmp dir path | 648 | // Kill the child since it holds an open handle to its CWD which is the tmp dir path |
| 647 | _ = eval.child.kill(io) catch {}; | 649 | eval.child.kill(io); |
| 648 | Dir.cwd().deleteTree(io, eval.tmp_dir_path) catch |err| { | 650 | Dir.cwd().deleteTree(io, eval.tmp_dir_path) catch |err| { |
| 649 | std.log.warn("failed to delete tree '{s}': {t}", .{ eval.tmp_dir_path, err }); | 651 | std.log.warn("failed to delete tree '{s}': {t}", .{ eval.tmp_dir_path, err }); |
| 650 | }; | 652 | }; |