Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/bootstrap/src/core/build_steps/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,16 @@ fn clean_default(build: &Build) {
}

fn rm_rf(path: &Path) {
match fs::remove_dir_all(path) {
Ok(()) => return,
// Already deleted, nothing for us to do.
Err(e) if e.kind() == ErrorKind::NotFound => return,
_ => {}
}

// If remove_dir_all fails then retry.
// We do so manually so we can provide better diagnostics,
// e.g. pointing to the exact file that failed.
match path.symlink_metadata() {
Err(e) => {
if e.kind() == ErrorKind::NotFound {
Expand Down Expand Up @@ -235,7 +245,7 @@ where
t!(fs::set_permissions(path, p));
f(path).unwrap_or_else(|e| {
// Delete symlinked directories on Windows
if m.file_type().is_symlink() && path.is_dir() && fs::remove_dir(path).is_ok() {
if fs::remove_dir(path).is_ok() {
Comment thread
ChrisDenton marked this conversation as resolved.
return;
}
panic!("failed to {} {}: {}", desc, path.display(), e);
Expand Down
Loading