authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-04 17:46:44-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-04 17:46:44-08:00
logc8ecfad41a322260fae38a4115a94345ed9f94b7
tree257e1a63476d98c63e110197582e93ffea831e79
parentb4dbe483a720f3e06559e659a410152511087395

build runner: clean up tmp dirs


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

lib/compiler/build_runner.zig+14
...@@ -784,6 +784,9 @@ fn runStepNames(...@@ -784,6 +784,9 @@ fn runStepNames(
784 var pending_count: usize = 0;784 var pending_count: usize = 0;
785 var total_compile_errors: usize = 0;785 var total_compile_errors: usize = 0;
786786
787 var cleanup_task = io.async(cleanTmpFiles, .{ io, step_stack.keys() });
788 defer cleanup_task.await(io);
789
787 for (step_stack.keys()) |s| {790 for (step_stack.keys()) |s| {
788 test_pass_count += s.test_results.passCount();791 test_pass_count += s.test_results.passCount();
789 test_skip_count += s.test_results.skip_count;792 test_skip_count += s.test_results.skip_count;
...@@ -1849,3 +1852,14 @@ fn initStdoutWriter(io: Io) *Writer {...@@ -1849,3 +1852,14 @@ fn initStdoutWriter(io: Io) *Writer {
1849 stdout_writer_allocation = Io.File.stdout().writerStreaming(io, &stdio_buffer_allocation);1852 stdout_writer_allocation = Io.File.stdout().writerStreaming(io, &stdio_buffer_allocation);
1850 return &stdout_writer_allocation.interface;1853 return &stdout_writer_allocation.interface;
1851}1854}
1855
1856fn cleanTmpFiles(io: Io, steps: []const *Step) void {
1857 for (steps) |step| {
1858 const wf = step.cast(std.Build.Step.WriteFile) orelse continue;
1859 if (wf.mode != .tmp) continue;
1860 const path = wf.generated_directory.path orelse continue;
1861 Io.Dir.cwd().deleteTree(io, path) catch |err| {
1862 std.log.warn("failed to delete {s}: {t}", .{ path, err });
1863 };
1864 }
1865}