Skip to content

Commit 8d7c374

Browse files
committed
improve rustup check in x setup
Signed-off-by: onur-ozkan <[email protected]>
1 parent bc0bc91 commit 8d7c374

File tree

1 file changed

+15
-4
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+15
-4
lines changed

Diff for: src/bootstrap/src/core/build_steps/setup.rs

+15-4
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,11 @@ pub struct Link;
247247
impl Step for Link {
248248
type Output = ();
249249
const DEFAULT: bool = true;
250+
250251
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
251252
run.alias("link")
252253
}
254+
253255
fn make_run(run: RunConfig<'_>) {
254256
if run.builder.config.dry_run() {
255257
return;
@@ -262,21 +264,30 @@ impl Step for Link {
262264
}
263265
fn run(self, builder: &Builder<'_>) -> Self::Output {
264266
let config = &builder.config;
267+
265268
if config.dry_run() {
266269
return;
267270
}
271+
272+
if !rustup_installed(builder) {
273+
println!("WARNING: `rustup` is not installed; Skipping `stage1` toolchain linking.");
274+
return;
275+
}
276+
268277
let stage_path =
269278
["build", config.build.rustc_target_arg(), "stage1"].join(MAIN_SEPARATOR_STR);
270-
if !rustup_installed(builder) {
271-
eprintln!("`rustup` is not installed; cannot link `stage1` toolchain");
272-
} else if stage_dir_exists(&stage_path[..]) && !config.dry_run() {
279+
280+
if stage_dir_exists(&stage_path[..]) && !config.dry_run() {
273281
attempt_toolchain_link(builder, &stage_path[..]);
274282
}
275283
}
276284
}
277285

278286
fn rustup_installed(builder: &Builder<'_>) -> bool {
279-
command("rustup").arg("--version").run_capture_stdout(builder).is_success()
287+
let mut rustup = command("rustup");
288+
rustup.arg("--version");
289+
290+
rustup.allow_failure().run_always().run_capture_stdout(builder).is_success()
280291
}
281292

282293
fn stage_dir_exists(stage_path: &str) -> bool {

0 commit comments

Comments
 (0)