From a91446986919aa0166f3abf63365c1e585ff6a44 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 14 Dec 2017 13:33:42 -0600 Subject: [PATCH] Retry to install proxies during already up-to-date self update CC https://github.com/rust-lang-nursery/rustup.rs/issues/1305 which this hopefully fixes. --- src/rustup-cli/common.rs | 3 +++ src/rustup-cli/self_update.rs | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/rustup-cli/common.rs b/src/rustup-cli/common.rs index 088c51980f..f4e9b4dca9 100644 --- a/src/rustup-cli/common.rs +++ b/src/rustup-cli/common.rs @@ -213,6 +213,9 @@ pub fn update_all_channels(cfg: &Cfg, self_update: bool) -> Result<()> { try!(self_update::run_update(setup_path)); unreachable!(); // update exits on success + } else if self_update { + // Try again in case we emitted "tool `{}` is already installed" last time. + self_update::install_proxies()?; } Ok(()) diff --git a/src/rustup-cli/self_update.rs b/src/rustup-cli/self_update.rs index d73c3c6e7d..35f7904930 100644 --- a/src/rustup-cli/self_update.rs +++ b/src/rustup-cli/self_update.rs @@ -650,6 +650,12 @@ fn install_bins() -> Result<()> { } try!(utils::copy_file(this_exe_path, rustup_path)); try!(utils::make_executable(rustup_path)); + install_proxies() +} + +pub fn install_proxies() -> Result<()> { + let ref bin_path = try!(utils::cargo_home()).join("bin"); + let ref rustup_path = bin_path.join(&format!("rustup{}", EXE_SUFFIX)); // Record the size of the known links, then when we get files which may or // may not be links, we compare their size. Same size means probably a link. @@ -1347,6 +1353,9 @@ pub fn update() -> Result<()> { info!("rustup updated successfully to {}", version); try!(run_update(p)); + } else { + // Try again in case we emitted "tool `{}` is already installed" last time. + install_proxies()? } Ok(())