Skip to content

Commit

Permalink
Merge pull request #1539 from hermit-os/cargo-home
Browse files Browse the repository at this point in the history
fix(xtask): use canonical `cargo_home` location
  • Loading branch information
mkroening authored Jan 3, 2025
2 parents 4c95afd + addf9f0 commit 1523adb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 3 additions & 7 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mod clippy;
mod doc;

use std::env;
use std::path::{Path, PathBuf};
use std::path::Path;
use std::process::Command;

use anyhow::Result;
Expand Down Expand Up @@ -71,14 +71,10 @@ 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() {
cargo_home
} else {
PathBuf::from(exe)
}
cargo_home
};

let mut cmd = Command::new(cmd);
Expand Down

0 comments on commit 1523adb

Please sign in to comment.