Skip to content
Snippets Groups Projects
Unverified Commit 0da4bd16 authored by Javier Viola's avatar Javier Viola Committed by GitHub
Browse files

fix: leaking env to node process and log cmd (native provider) (#213)

fix #210 

Also fix the log cmd string.

cc @michalkucharczyk , thanks!!
parent 11ea1254
Branches
No related merge requests found
Pipeline #474692 passed with stage
in 16 minutes and 3 seconds
use std::{
collections::HashMap,
env,
path::{Path, PathBuf},
process::Stdio,
sync::{Arc, Weak},
......@@ -225,8 +227,14 @@ where
}
async fn initialize_process(&self) -> Result<(ChildStdout, ChildStderr), ProviderError> {
let filtered_env: HashMap<String, String> = env::vars()
.filter(|(k, _)| k == "TZ" || k == "LANG" || k == "PATH")
.collect();
let mut process = Command::new(&self.program)
.args(&self.args)
.env_clear()
.envs(&filtered_env) // minimal environment
.envs(self.env.to_vec())
.stdin(Stdio::null())
.stdout(Stdio::piped())
......@@ -397,8 +405,11 @@ where
}
fn log_cmd(&self) -> String {
let base_dir = format!("{}/{}", self.base_dir().to_string_lossy(), self.name());
format!("tail -f {}/{}.log", base_dir, self.name())
format!(
"tail -f {}/{}.log",
self.base_dir().to_string_lossy(),
self.name()
)
}
fn path_in_node(&self, file: &Path) -> PathBuf {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment