From 693b4d68a26122cc9f3e70ff8d63e5233f07f1f6 Mon Sep 17 00:00:00 2001 From: Denis Cornehl Date: Fri, 6 Oct 2023 08:31:12 +0200 Subject: [PATCH] purge all rustwide build directories before each build --- src/docbuilder/rustwide_builder.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/docbuilder/rustwide_builder.rs b/src/docbuilder/rustwide_builder.rs index 6d2980e5d..8a0354d4f 100644 --- a/src/docbuilder/rustwide_builder.rs +++ b/src/docbuilder/rustwide_builder.rs @@ -363,6 +363,19 @@ impl RustwideBuilder { } } + // FIXME: for now, purge all build dirs before each build. + // Currently we have some error situations where the build directory wouldn't be deleted + // after the build failed: + // https://github.com/rust-lang/docs.rs/issues/820 + // This should be solved in a better way, likely refactoring the whole builder structure, + // but for now we chose this simple way to prevent that the build directory remains can + // fill up disk space. + // This also prevents having multiple builders using the same rustwide workspace, + // which we don't do. Currently our separate builders use a separate rustwide workspace. + self.workspace + .purge_all_build_dirs() + .map_err(FailureError::compat)?; + let mut build_dir = self.workspace.build_dir(&format!("{name}-{version}")); build_dir.purge().map_err(FailureError::compat)?;