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

uninstalls toolchains prior to deleting the rustup home folder #2864

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Darunada
Copy link

@Darunada Darunada commented Oct 9, 2021

Fixes #2789

I was able to reproduce the issue, and with this change the command now succeeds with the following output.

C:\Users\Lea>rustup self uninstall


Thanks for hacking in Rust!

This will uninstall all Rust toolchains and data, and remove
%USERPROFILE%\.cargo/bin from your PATH environment variable.

Continue? (y/N) y

info: removing toolchains
info: uninstalling toolchain 'nightly-x86_64-pc-windows-msvc'
info: toolchain 'nightly-x86_64-pc-windows-msvc' uninstalled
info: uninstalling toolchain 'stage2'
info: toolchain 'stage2' uninstalled
info: removing rustup home
info: removing cargo home
info: removing rustup binaries
info: rustup is uninstalled

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see at least one test validating that this uninstall is happening. Probably it ought to be a new test in tests/cli-self-upd.rs something like an fn uninstall_removes_installed_toolchains()

@Darunada
Copy link
Author

sure thing, work has gotten a bit more stressful in the last couple weeks, I will try to do something this weekend

@Rustin170506
Copy link
Member

@Darunada Do you still have time to advance it? If you don't have time I would be happy to help add that test. But it would be great if you could move forward. Thanks!

@Darunada Darunada force-pushed the self-uninstall-remove-toolchains branch from 10e3130 to 5a9b7a0 Compare February 25, 2023 19:05
@Darunada Darunada force-pushed the self-uninstall-remove-toolchains branch from 5a9b7a0 to 4abc90a Compare February 25, 2023 19:11
@Darunada Darunada marked this pull request as draft February 25, 2023 19:29
@Darunada Darunada force-pushed the self-uninstall-remove-toolchains branch from 2e7c6c9 to 6745cd9 Compare February 25, 2023 20:54
@Darunada Darunada marked this pull request as ready for review February 25, 2023 21:41
@Darunada
Copy link
Author

Sorry for the delay, I went ahead and added a test. Let me know if you like the approach!

let no_prompt = m.get_flag("no-prompt");

self_update::uninstall(no_prompt)
fn self_uninstall(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<utils::ExitCode> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't have a lifetime argument here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustup self uninstall fails on Windows if a custom toolchain is installed
3 participants