Skip to content

Fallback to default update root if passed root is empty #4424

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/cli/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,16 @@ This will uninstall all Rust toolchains and data, and remove
static DEFAULT_UPDATE_ROOT: &str = "https://static.rust-lang.org/rustup";

fn update_root(process: &Process) -> String {
process
.var("RUSTUP_UPDATE_ROOT")
.inspect(|url| trace!("`RUSTUP_UPDATE_ROOT` has been set to `{url}`"))
.unwrap_or_else(|_| String::from(DEFAULT_UPDATE_ROOT))
match non_empty_env_var("RUSTUP_UPDATE_ROOT", process)
.ok()
.flatten()
{
Some(url) => {
trace!("`RUSTUP_UPDATE_ROOT` has been set to `{url}`");
url
}
None => String::from(DEFAULT_UPDATE_ROOT),
}
}

/// `CARGO_HOME` suitable for display, possibly with $HOME
Expand Down
Loading