From 5aa584a2fe84ebd272a49c88b320c6c4758c81df Mon Sep 17 00:00:00 2001 From: Victor Dumitrescu Date: Tue, 28 Nov 2023 10:03:19 +0100 Subject: [PATCH] build.rs: check that cargo binary exists, use exported one otherwise --- hermit/build.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hermit/build.rs b/hermit/build.rs index 237a29975..03c89e5d6 100644 --- a/hermit/build.rs +++ b/hermit/build.rs @@ -168,7 +168,11 @@ fn cargo() -> Command { // To reach the rustup proxy nonetheless, we explicitly query $CARGO_HOME. let mut cargo_home = PathBuf::from(env::var_os("CARGO_HOME").unwrap()); cargo_home.push("bin/cargo"); - cargo_home + if cargo_home.exists() { + cargo_home + } else { + PathBuf::from("cargo") + } }; let mut cargo = Command::new(cargo);