Skip to content

Commit

Permalink
Merge pull request #1310 from SimonSapin/update-installs-proxies
Browse files Browse the repository at this point in the history
Retry to install proxies during already up-to-date self update
  • Loading branch information
alexcrichton authored Dec 17, 2017
2 parents 9b1b54a + a914469 commit cb2d148
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rustup-cli/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
9 changes: 9 additions & 0 deletions src/rustup-cli/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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(())
Expand Down

0 comments on commit cb2d148

Please sign in to comment.