Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix misleading "uninstalled toolchain" notification #3869

Merged
merged 1 commit into from
Jun 12, 2024
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
9 changes: 6 additions & 3 deletions src/toolchain/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ impl<'a> Toolchain<'a> {
LocalToolchainName::Named(t) => t,
LocalToolchainName::Path(_) => bail!("Cannot remove a path based toolchain"),
};
match Self::exists(cfg, &(&name).into())? {
let fs_modified = match Self::exists(cfg, &(&name).into())? {
true => {
(cfg.notify_handler)(Notification::UninstallingToolchain(&name));
let installed_paths = match &name {
Expand All @@ -466,19 +466,22 @@ impl<'a> Toolchain<'a> {
}
}
}
true
}
false => {
// Might be a dangling symlink
if path.is_symlink() {
(cfg.notify_handler)(Notification::UninstallingToolchain(&name));
fs::remove_dir_all(&path)?;
true
} else {
info!("no toolchain installed for '{name}'");
false
}
}
}
};

if !path.is_symlink() && !path.exists() {
if !path.is_symlink() && !path.exists() && fs_modified {
(cfg.notify_handler)(Notification::UninstalledToolchain(&name));
}
Ok(())
Expand Down
Loading