Skip to content

cargo uninstall tries to delete executables that are running, which fails on Windows #3364

@FaultyRAM

Description

@FaultyRAM

cargo uninstall doesn't take into account that the crate being uninstalled may in fact be running, and that attempting to delete such an executable will fail on Windows. Because removing the binary is the last step in the uninstall process, this leads to a phenonemon I dub "Schrödinger's crate", in which a crate is both installed and uninstalled; the executable still exists, so cargo install fails, but all installation metadata is gone, so cargo uninstall fails!

One way to cause this is via the Rusty Code plugin for VS Code; it depends on Racer, which can be installed via cargo install and is active while Rusty Code is active. Trying to cargo uninstall Racer in this situation leads to breakage as described above.

You can work around this by deleting the leftover executable after making sure it isn't running; cargo install --force also works.

Tested with the latest nightly Rust, installed via rustup-rs:

rustc 1.15.0-nightly (908dba0c9 2016-12-01)
binary: rustc
commit-hash: 908dba0c9477b7dd022a236cb1514ddfca9369f2
commit-date: 2016-12-01
host: x86_64-pc-windows-msvc
release: 1.15.0-nightly
LLVM version: 3.9
cargo 0.16.0-nightly (3568be9 2016-11-26)

Metadata

Metadata

Assignees

Labels

C-bugCategory: bugCommand-uninstallE-easyExperience: EasyO-windowsOS: WindowsS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions