From c8ecfad41a322260fae38a4115a94345ed9f94b7 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 4 Jan 2026 17:46:44 -0800 Subject: [PATCH] build runner: clean up tmp dirs --- lib/compiler/build_runner.zig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/compiler/build_runner.zig b/lib/compiler/build_runner.zig index 395ae76426e5e5068b58242d8e07bfeea516c9f4..e479ca725a9c0b5041832e069120c9ca0b98c1d6 100644 --- a/lib/compiler/build_runner.zig +++ b/lib/compiler/build_runner.zig @@ -784,6 +784,9 @@ fn runStepNames( var pending_count: usize = 0; var total_compile_errors: usize = 0; + var cleanup_task = io.async(cleanTmpFiles, .{ io, step_stack.keys() }); + defer cleanup_task.await(io); + for (step_stack.keys()) |s| { test_pass_count += s.test_results.passCount(); test_skip_count += s.test_results.skip_count; @@ -1849,3 +1852,14 @@ fn initStdoutWriter(io: Io) *Writer { stdout_writer_allocation = Io.File.stdout().writerStreaming(io, &stdio_buffer_allocation); return &stdout_writer_allocation.interface; } + +fn cleanTmpFiles(io: Io, steps: []const *Step) void { + for (steps) |step| { + const wf = step.cast(std.Build.Step.WriteFile) orelse continue; + if (wf.mode != .tmp) continue; + const path = wf.generated_directory.path orelse continue; + Io.Dir.cwd().deleteTree(io, path) catch |err| { + std.log.warn("failed to delete {s}: {t}", .{ path, err }); + }; + } +} -- 2.54.0