Replace remove_dir_all with remove_virtualenv (#16203)

## Summary

Replace `remove_dir_all` with `remove_virtualenv` for the tool environment creation code path.

Closes #14985

## Test Plan

Relied on existing test coverage.

---------

Co-authored-by: Tomasz Kramkowski <tomasz@kramkow.ski>
This commit is contained in:
Mitchell Berendhuysen
2026-03-04 14:30:33 +01:00
committed by GitHub
parent 379f056aff
commit d58915e8b3
+2 -2
View File
@@ -314,14 +314,14 @@ impl InstalledTools {
let environment_path = self.tool_dir(name);
// Remove any existing environment.
match fs_err::remove_dir_all(&environment_path) {
match remove_virtualenv(&environment_path) {
Ok(()) => {
debug!(
"Removed existing environment for tool `{name}`: {}",
environment_path.user_display()
);
}
Err(err) if err.kind() == io::ErrorKind::NotFound => (),
Err(uv_virtualenv::Error::Io(err)) if err.kind() == io::ErrorKind::NotFound => (),
Err(err) => return Err(err.into()),
}