Skip to content

Commit 29d4bc8

Browse files
committed
Display helpful advices even with -y.
Currently -y disables any helpful advices, but example usages of curl-based rustup installation frequently include -y (unfortunately). Since -y is not a silent flag but a yes-to-all flag, we can always display advices instead and (on Windows) only pause unless -y is given.
1 parent ab75525 commit 29d4bc8

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

src/rustup-cli/self_update.rs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -297,28 +297,27 @@ pub fn install(no_prompt: bool, verbose: bool,
297297
process::exit(1);
298298
}
299299

300-
// More helpful advice, skip if -y
301-
if !no_prompt {
302-
let cargo_home = try!(canonical_cargo_home());
303-
let msg = if !opts.no_modify_path {
304-
if cfg!(unix) {
305-
format!(post_install_msg_unix!(),
306-
cargo_home = cargo_home)
307-
} else {
308-
format!(post_install_msg_win!(),
309-
cargo_home = cargo_home)
310-
}
300+
let cargo_home = try!(canonical_cargo_home());
301+
let msg = if !opts.no_modify_path {
302+
if cfg!(unix) {
303+
format!(post_install_msg_unix!(),
304+
cargo_home = cargo_home)
311305
} else {
312-
if cfg!(unix) {
313-
format!(post_install_msg_unix_no_modify_path!(),
314-
cargo_home = cargo_home)
315-
} else {
316-
format!(post_install_msg_win_no_modify_path!(),
317-
cargo_home = cargo_home)
318-
}
319-
};
320-
term2::stdout().md(msg);
306+
format!(post_install_msg_win!(),
307+
cargo_home = cargo_home)
308+
}
309+
} else {
310+
if cfg!(unix) {
311+
format!(post_install_msg_unix_no_modify_path!(),
312+
cargo_home = cargo_home)
313+
} else {
314+
format!(post_install_msg_win_no_modify_path!(),
315+
cargo_home = cargo_home)
316+
}
317+
};
318+
term2::stdout().md(msg);
321319

320+
if !no_prompt {
322321
// On windows, where installation happens in a console
323322
// that may have opened just for this purpose, require
324323
// the user to press a key to continue.

0 commit comments

Comments
 (0)