🔒️ Move away from std::env::set_var, which is unsound

This commit is contained in:
Lucy 2022-06-24 14:46:14 -04:00
parent fb1a832916
commit c84857ae9b
No known key found for this signature in database
GPG key ID: EBC517FAD666BBF1
4 changed files with 12 additions and 6 deletions

View file

@ -27,7 +27,7 @@ impl ProcessHandler {
}
}
pub fn run(self, executable: impl ToString, args: Vec<String>) {
pub fn run(self, executable: impl ToString, args: Vec<String>, vars: Vec<(String, String)>) {
let executable = executable.to_string();
tokio::spawn(async move {
let mut child = match Command::new(&executable)
@ -35,6 +35,7 @@ impl ProcessHandler {
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.envs(vars)
.kill_on_drop(true)
.spawn()
{