Skip to content

Commit b0d3242

Browse files
committed
Auto merge of #1124 - pxdeu:fix/issue-916, r=Diggsey
fixes prompt asking for msvc even though -y is provided Fixes #916 no_prompt was simply not being checked
2 parents a0d0d21 + b6f105c commit b0d3242

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/rustup-cli/self_update.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ This will uninstall all Rust toolchains and data, and remove
165165
}
166166
}
167167

168-
#[cfg(windows)]
169168
static MSVC_MESSAGE: &'static str =
170169
r#"# Rust Visual C++ prerequisites
171170
@@ -224,8 +223,15 @@ pub fn install(no_prompt: bool, verbose: bool,
224223
try!(do_anti_sudo_check(no_prompt));
225224

226225
if !try!(do_msvc_check(&opts)) {
227-
info!("aborting installation");
228-
return Ok(());
226+
if no_prompt {
227+
warn!("installing msvc toolchain without its prerequisites");
228+
} else {
229+
term2::stdout().md(MSVC_MESSAGE);
230+
if !try!(common::confirm("\nContinue? (Y/n)", true)) {
231+
info!("aborting installation");
232+
return Ok(());
233+
}
234+
}
229235
}
230236

231237
if !no_prompt {
@@ -468,10 +474,7 @@ fn do_msvc_check(opts: &InstallOpts) -> Result<bool> {
468474
let installing_msvc = opts.default_host_triple.contains("msvc");
469475
let have_msvc = windows_registry::find_tool(&opts.default_host_triple, "cl.exe").is_some();
470476
if installing_msvc && !have_msvc {
471-
term2::stdout().md(MSVC_MESSAGE);
472-
if !try!(common::confirm("\nContinue? (Y/n)", true)) {
473-
return Ok(false);
474-
}
477+
return Ok(false);
475478
}
476479

477480
Ok(true)

0 commit comments

Comments
 (0)