Skip to content

Commit

Permalink
Update force_update param in install_from_dist calls in config.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
BeniCheni committed Oct 20, 2019
1 parent d63478d commit 71d1e72
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ impl Cfg {
ErrorKind::OverrideToolchainNotInstalled(name.to_string())
})
} else {
toolchain.install_from_dist(false, &[], &[])?;
toolchain.install_from_dist(true, &[], &[])?;
Ok(Some((toolchain, reason)))
}
}
Expand Down Expand Up @@ -478,7 +478,7 @@ impl Cfg {
) -> Result<Command> {
let toolchain = self.get_toolchain(toolchain, false)?;
if install_if_missing && !toolchain.exists() {
toolchain.install_from_dist(false, &[], &[])?;
toolchain.install_from_dist(true, &[], &[])?;
}

if let Some(cmd) = self.maybe_do_cargo_fallback(&toolchain, binary)? {
Expand Down
37 changes: 35 additions & 2 deletions tests/cli-v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
pub mod mock;

use crate::mock::clitools::{
self, expect_err, expect_not_stderr_ok, expect_not_stdout_ok, expect_ok, expect_stderr_ok,
expect_stdout_ok, set_current_dist_date, this_host_triple, Config, Scenario,
self, expect_err, expect_not_stderr_ok, expect_not_stdout_ok, expect_ok, expect_ok_ex,
expect_stderr_ok, expect_stdout_ok, set_current_dist_date, this_host_triple, Config, Scenario,
};
use std::fs;
use std::io::Write;
Expand Down Expand Up @@ -1185,3 +1185,36 @@ fn test_complete_profile_skips_missing_when_forced() {
);
})
}

#[test]
fn run_with_install_flag_against_unavailable_component() {
setup(&|config| {
let trip = TargetTriple::from_build();
make_component_unavailable(config, "rust-std", &trip);
expect_ok_ex(
config,
&[
"rustup",
"run",
"--install",
"nightly",
"rustc",
"--version",
],
"1.3.0 (hash-nightly-2)
",
for_host!(
r"info: syncing channel updates for 'nightly-{0}'
info: latest update on 2015-01-02, rust version 1.3.0 (hash-nightly-2)
warning: Force-skipping unavailable component 'rust-std-x86_64-apple-darwin'
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: downloading component 'rustc'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: installing component 'rustc'
"
),
);
});
}

0 comments on commit 71d1e72

Please sign in to comment.