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:
Profpatsch 2021-02-09 20:55:35 +01:00
parent 4d9e5d8e47
commit 7a4aca42ad

View file

@ -20,7 +20,7 @@ let
None => std::ffi::OsStr::from_bytes("ARGLIB_NETENCODE".as_bytes()),
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())),
// TODO: good error handling for the different parser errors
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))
}
}
};
std::env::remove_var(env);
t
}
'';
};