Skip to content

Commit a72eb13

Browse files
luffykaijonathanpwang
authored andcommitted
chore: allow cargo home env var in build (#1609)
1 parent eba22d9 commit a72eb13

File tree

1 file changed

+4
-1
lines changed
  • crates/toolchain/build/src

1 file changed

+4
-1
lines changed

crates/toolchain/build/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const RUSTUP_TOOLCHAIN_NAME: &str = "nightly-2025-02-14";
2525
const BUILD_LOCKED_ENV: &str = "OPENVM_BUILD_LOCKED";
2626
const SKIP_BUILD_ENV: &str = "OPENVM_SKIP_BUILD";
2727
const GUEST_LOGFILE_ENV: &str = "OPENVM_GUEST_LOGFILE";
28+
const ALLOWED_CARGO_ENVS: &[&str] = &["CARGO_HOME"];
2829

2930
/// Returns the given cargo Package from the metadata in the Cargo.toml manifest
3031
/// within the provided `manifest_dir`.
@@ -157,7 +158,9 @@ pub fn guest_methods<S: AsRef<str>>(
157158
/// removed.
158159
fn sanitized_cmd(tool: &str) -> Command {
159160
let mut cmd = Command::new(tool);
160-
for (key, _val) in env::vars().filter(|x| x.0.starts_with("CARGO")) {
161+
for (key, _val) in env::vars()
162+
.filter(|x| x.0.starts_with("CARGO") && !ALLOWED_CARGO_ENVS.contains(&x.0.as_str()))
163+
{
161164
cmd.env_remove(key);
162165
}
163166
cmd.env_remove("RUSTUP_TOOLCHAIN");

0 commit comments

Comments
 (0)