Problem
I'm trying to use cargo install in CI on GitHub, to install cargo-tarpaulin. However cargo install might fail if the CI agent already has the version of cargo-tarpaulin that I need. Since it takes a bit to install, I also want to use GitHub caching, so want to avoid --force. However, I still want to fail CI if the install fails for any other reason than "the version is already installed". Unfortunately cargo returns a single error code so there's no way for me to discriminate those two failures, and no easy way that I know of either to check if a binary is installed (cargo install --list is hard to parse via script due to its nested listing which outputs both the package and its binaries, which are often the same).
Proposed Solution
Have cargo return a different error code when not using --force and the version of the binary is already installed.
Notes
Briefly discussed on Discord here.
Problem
I'm trying to use
cargo installin CI on GitHub, to installcargo-tarpaulin. Howevercargo installmight fail if the CI agent already has the version ofcargo-tarpaulinthat I need. Since it takes a bit to install, I also want to use GitHub caching, so want to avoid--force. However, I still want to fail CI if the install fails for any other reason than "the version is already installed". Unfortunatelycargoreturns a single error code so there's no way for me to discriminate those two failures, and no easy way that I know of either to check if a binary is installed (cargo install --listis hard to parse via script due to its nested listing which outputs both the package and its binaries, which are often the same).Proposed Solution
Have
cargoreturn a different error code when not using--forceand the version of the binary is already installed.Notes
Briefly discussed on Discord here.