Exclude env vars using flag
This commit is contained in:
parent
1ae1d71938
commit
c1cec3b247
@ -42,7 +42,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
|
|||||||
MemoryExtra::new(StdRng::seed_from_u64(config.seed.unwrap_or(0)), config.validate),
|
MemoryExtra::new(StdRng::seed_from_u64(config.seed.unwrap_or(0)), config.validate),
|
||||||
);
|
);
|
||||||
// Complete initialization.
|
// Complete initialization.
|
||||||
EnvVars::init(&mut ecx);
|
EnvVars::init(&mut ecx, config.excluded_env_vars);
|
||||||
|
|
||||||
// Setup first stack-frame
|
// Setup first stack-frame
|
||||||
let main_instance = ty::Instance::mono(ecx.tcx.tcx, main_id);
|
let main_instance = ty::Instance::mono(ecx.tcx.tcx, main_id);
|
||||||
|
@ -15,11 +15,14 @@ pub struct EnvVars {
|
|||||||
impl EnvVars {
|
impl EnvVars {
|
||||||
pub(crate) fn init<'mir, 'tcx>(
|
pub(crate) fn init<'mir, 'tcx>(
|
||||||
ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'tcx>>,
|
ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'tcx>>,
|
||||||
|
excluded_env_vars: Vec<String>,
|
||||||
) {
|
) {
|
||||||
if ecx.machine.communicate {
|
if ecx.machine.communicate {
|
||||||
for (name, value) in std::env::vars() {
|
for (name, value) in std::env::vars() {
|
||||||
let var_ptr = alloc_env_var(name.as_bytes(), value.as_bytes(), ecx.memory_mut());
|
if !excluded_env_vars.contains(&name) {
|
||||||
ecx.machine.env_vars.map.insert(name.into_bytes(), var_ptr);
|
let var_ptr = alloc_env_var(name.as_bytes(), value.as_bytes(), ecx.memory_mut());
|
||||||
|
ecx.machine.env_vars.map.insert(name.into_bytes(), var_ptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user