Skip to content

Commit 7313369

Browse files
committed
chore: adjust xtask env variables
1 parent b34ff20 commit 7313369

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/xtask/src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1412,8 +1412,11 @@ impl Xtasks {
14121412
/// Set them to MAIN_CARGO_<VARIABLE> so that we can reference them but so they dont get inherited by further cargo commands
14131413
fn pop_cargo_env() -> Result<()> {
14141414
let env = std::env::vars().collect::<Vec<_>>();
1415+
// RUSTUP TOOLCHAIN exclude is a temporary fix, it might make deving the api codegen crate not work
1416+
let exclude_list = ["CARGO_HOME", "RUSTUP_TOOLCHAIN"];
1417+
14151418
for (key, value) in env.iter() {
1416-
if key.starts_with("CARGO_") {
1419+
if key.starts_with("CARGO_") && !exclude_list.contains(&(key.as_str())) {
14171420
let new_key = format!("MAIN_{}", key);
14181421
std::env::set_var(new_key, value);
14191422
std::env::remove_var(key);
@@ -1423,6 +1426,9 @@ fn pop_cargo_env() -> Result<()> {
14231426
// unset some other variables
14241427
let remove_vars = ["RUSTUP_TOOLCHAIN"];
14251428
for var in remove_vars.iter() {
1429+
if exclude_list.contains(var) {
1430+
continue;
1431+
}
14261432
std::env::remove_var(var);
14271433
}
14281434

0 commit comments

Comments
 (0)