From d99e982de191a86fba9061bef45669b09b3b2c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Fri, 3 Jan 2025 11:52:47 +0100 Subject: [PATCH] fix(xtask): use canonical `cargo_home` location --- Cargo.lock | 10 ++++++++++ xtask/Cargo.toml | 1 + xtask/src/main.rs | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 8b02697383..9440e8069e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -686,6 +686,15 @@ dependencies = [ "spinning_top", ] +[[package]] +name = "home" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "iana-time-zone" version = "0.1.61" @@ -2105,6 +2114,7 @@ dependencies = [ "anyhow", "clap", "goblin", + "home", "sysinfo", "ureq", "wait-timeout", diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index dbf256ea87..43beecc5af 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -7,6 +7,7 @@ edition = "2024" anyhow = "1.0" clap = { version = "4", features = ["derive"] } goblin = { version = "0.9", default-features = false, features = ["archive", "elf32", "elf64", "std"] } +home = "0.5" sysinfo = "0.33" ureq = "2" wait-timeout = "0.2" diff --git a/xtask/src/main.rs b/xtask/src/main.rs index c0ac97827a..6fee72dc03 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -71,7 +71,7 @@ fn sanitize(cmd: &str) -> Command { let exe = format!("{cmd}{}", env::consts::EXE_SUFFIX); // On windows, the userspace toolchain ends up in front of the rustup proxy in $PATH. // To reach the rustup proxy nonetheless, we explicitly query $CARGO_HOME. - let mut cargo_home = PathBuf::from(env::var_os("CARGO_HOME").unwrap()); + let mut cargo_home = home::cargo_home().unwrap(); cargo_home.push("bin"); cargo_home.push(&exe); if cargo_home.exists() {