authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2025-11-08 23:45:31-08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-11-09 07:45:31+00:00
log5358af7ba4cf16bef1734729646b99842e439916
tree53692a8d90341f2a2e3d842875d3f0f7dc822e33
parentb31a03f134792b8fae20a625f68499c6548f8443
signaturebadge-check Signed by PGP key B5690EEEBB952194

incr-check: Kill child process on error

Since the child process is spawned with the tmp directory as its CWD, the child process opens it without DELETE access. On error, the child process would still be alive while the tmp directory is attempting to be deleted, so it would fail with `.SHARING_VIOLATION => return error.FileBusy`. Fixes arguably the least important part of #22510, since it's only the directory itself that would fail to get deleted, all the files inside would get deleted just fine.

1 files changed, 5 insertions(+), 0 deletions(-)

tools/incr-check.zig+5
......@@ -197,6 +197,9 @@ pub fn main() !void {
197197 };
198198
199199 try child.spawn();
200 errdefer {
201 _ = child.kill() catch {};
202 }
200203
201204 var poller = Io.poll(arena, Eval.StreamEnum, .{
202205 .stdout = child.stdout.?,
......@@ -585,6 +588,8 @@ const Eval = struct {
585588 fn fatal(eval: *Eval, comptime fmt: []const u8, args: anytype) noreturn {
586589 eval.tmp_dir.close();
587590 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 {};
588593 std.fs.cwd().deleteTree(eval.tmp_dir_path) catch |err| {
589594 std.log.warn("failed to delete tree '{s}': {s}", .{ eval.tmp_dir_path, @errorName(err) });
590595 };