honor CARGO env var (for rustc bootstrap)

This commit is contained in:
Ralf Jung 2019-08-02 18:02:54 +02:00
parent f0e871785f
commit 0dab3d5ee1

View file

@ -231,7 +231,14 @@ fn setup(ask_user: bool) {
} else {
println!("Installing xargo: `cargo install xargo -f`");
}
if !Command::new("cargo").args(&["install", "xargo", "-f"]).status().unwrap().success() {
let mut cargo = if let Ok(val) = std::env::var("CARGO") {
// In rustc bootstrap, an env var tells us where to find cargo.
Command::new(val)
} else {
Command::new("cargo")
};
if !cargo.args(&["install", "xargo", "-f"]).status().unwrap().success() {
show_error(format!("Failed to install xargo"));
}
}