fix(users/Profpatsch/arglib): remove env var after read
arglib should remove its arguments after reading it, to prevent them from leaking to any child processes. Change-Id: Ifc107b1620b8e407bad6b3d0ad7f4728856ec2ba Reviewed-on: https://cl.tvl.fyi/c/depot/+/2501 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
This commit is contained in:
parent
4d9e5d8e47
commit
7a4aca42ad
1 changed files with 4 additions and 2 deletions
|
@ -20,7 +20,7 @@ let
|
||||||
None => std::ffi::OsStr::from_bytes("ARGLIB_NETENCODE".as_bytes()),
|
None => std::ffi::OsStr::from_bytes("ARGLIB_NETENCODE".as_bytes()),
|
||||||
Some(a) => a
|
Some(a) => a
|
||||||
};
|
};
|
||||||
match std::env::var_os(env) {
|
let t = match std::env::var_os(env) {
|
||||||
None => exec_helpers::die_user_error(prog_name, format!("could not read args, envvar {} not set", env.to_string_lossy())),
|
None => exec_helpers::die_user_error(prog_name, format!("could not read args, envvar {} not set", env.to_string_lossy())),
|
||||||
// TODO: good error handling for the different parser errors
|
// TODO: good error handling for the different parser errors
|
||||||
Some(soup) => match netencode::parse::t_t(soup.as_bytes()) {
|
Some(soup) => match netencode::parse::t_t(soup.as_bytes()) {
|
||||||
|
@ -30,7 +30,9 @@ let
|
||||||
},
|
},
|
||||||
Err(err) => exec_helpers::die_environment_problem(prog_name, format!("arglib parsing error: {:?}", err))
|
Err(err) => exec_helpers::die_environment_problem(prog_name, format!("arglib parsing error: {:?}", err))
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
std::env::remove_var(env);
|
||||||
|
t
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue