Skip to content

Commit e992c28

Browse files
committed
Only keep PATH
1 parent f8c32be commit e992c28

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

plrustc/plrustc/src/main.rs

+6-14
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,13 @@ impl Callbacks for PlrustcCallbacks {
4949
}
5050
}
5151
}
52+
5253
fn clear_env() {
53-
let all_var_names = std::env::vars_os()
54-
.map(|(name, _)| name)
55-
.filter(|name| {
56-
let name = name.to_string_lossy().to_lowercase();
57-
!(
58-
name.starts_with("plrust")
59-
// || name.starts_with("rust")
60-
// || name.starts_with("cargo")
61-
|| name == "path"
62-
// || name == "rustflags"
63-
)
64-
})
65-
.collect::<Vec<_>>();
66-
for name in all_var_names {
54+
for (name, _) in std::env::vars_os() {
55+
// Can't remove `PATH`, need it to locate linker and such.
56+
if name == "PATH" {
57+
continue;
58+
}
6759
std::env::remove_var(name);
6860
}
6961
}

0 commit comments

Comments
 (0)