| ... | @@ -197,6 +197,9 @@ pub fn main() !void { | ... | @@ -197,6 +197,9 @@ pub fn main() !void { |
| 197 | }; | 197 | }; |
| 198 | | 198 | |
| 199 | try child.spawn(); | 199 | try child.spawn(); |
| | 200 | errdefer { |
| | 201 | _ = child.kill() catch {}; |
| | 202 | } |
| 200 | | 203 | |
| 201 | var poller = Io.poll(arena, Eval.StreamEnum, .{ | 204 | var poller = Io.poll(arena, Eval.StreamEnum, .{ |
| 202 | .stdout = child.stdout.?, | 205 | .stdout = child.stdout.?, |
| ... | @@ -585,6 +588,8 @@ const Eval = struct { | ... | @@ -585,6 +588,8 @@ const Eval = struct { |
| 585 | fn fatal(eval: *Eval, comptime fmt: []const u8, args: anytype) noreturn { | 588 | fn fatal(eval: *Eval, comptime fmt: []const u8, args: anytype) noreturn { |
| 586 | eval.tmp_dir.close(); | 589 | eval.tmp_dir.close(); |
| 587 | if (!eval.preserve_tmp_on_fatal) { | 590 | if (!eval.preserve_tmp_on_fatal) { |
| | 591 | // Kill the child since it holds an open handle to its CWD which is the tmp dir path |
| | 592 | _ = eval.child.kill() catch {}; |
| 588 | std.fs.cwd().deleteTree(eval.tmp_dir_path) catch |err| { | 593 | std.fs.cwd().deleteTree(eval.tmp_dir_path) catch |err| { |
| 589 | std.log.warn("failed to delete tree '{s}': {s}", .{ eval.tmp_dir_path, @errorName(err) }); | 594 | std.log.warn("failed to delete tree '{s}': {s}", .{ eval.tmp_dir_path, @errorName(err) }); |
| 590 | }; | 595 | }; |