use crate::icp::CANIC_ICP_IDENTITY_PASSWORD_FILE_ENV;
use std::{
env,
ffi::{OsStr, OsString},
process::Command,
};
pub fn command(program: impl AsRef<OsStr>) -> Command {
let mut command = Command::new(program);
apply(&mut command);
command
}
pub fn apply(command: &mut Command) {
command
.env_remove(CANIC_ICP_IDENTITY_PASSWORD_FILE_ENV)
.env("SHLVL", "0");
}
pub fn inputs() -> Vec<(OsString, OsString)> {
env::vars_os()
.filter(|(key, _)| key != CANIC_ICP_IDENTITY_PASSWORD_FILE_ENV && key != "SHLVL")
.chain([(OsString::from("SHLVL"), OsString::from("0"))])
.collect()
}