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)?;