Skip to content

Commit

Permalink
Only keep PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
thomcc committed Nov 2, 2023
1 parent f8c32be commit e992c28
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions plrustc/plrustc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,13 @@ impl Callbacks for PlrustcCallbacks {
}
}
}

fn clear_env() {
let all_var_names = std::env::vars_os()
.map(|(name, _)| name)
.filter(|name| {
let name = name.to_string_lossy().to_lowercase();
!(
name.starts_with("plrust")
// || name.starts_with("rust")
// || name.starts_with("cargo")
|| name == "path"
// || name == "rustflags"
)
})
.collect::<Vec<_>>();
for name in all_var_names {
for (name, _) in std::env::vars_os() {
// Can't remove `PATH`, need it to locate linker and such.
if name == "PATH" {
continue;
}
std::env::remove_var(name);
}
}
Expand Down

0 comments on commit e992c28

Please sign in to comment.