diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/js/40_process.js | 2 | ||||
-rw-r--r-- | runtime/ops/process.rs | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/runtime/js/40_process.js b/runtime/js/40_process.js index 70a590f36..543c53c27 100644 --- a/runtime/js/40_process.js +++ b/runtime/js/40_process.js @@ -100,6 +100,7 @@ function run({ cmd, cwd = undefined, + clearEnv = false, env = {}, stdout = "inherit", stderr = "inherit", @@ -111,6 +112,7 @@ const res = opRun({ cmd: ArrayPrototypeMap(cmd, String), cwd, + clearEnv, env: ObjectEntries(env), stdin: isRid(stdin) ? "" : stdin, stdout: isRid(stdout) ? "" : stdout, diff --git a/runtime/ops/process.rs b/runtime/ops/process.rs index 679deff98..0f0cc6e2a 100644 --- a/runtime/ops/process.rs +++ b/runtime/ops/process.rs @@ -61,6 +61,7 @@ fn subprocess_stdio_map(s: &str) -> Result<std::process::Stdio, AnyError> { pub struct RunArgs { cmd: Vec<String>, cwd: Option<String>, + clear_env: bool, env: Vec<(String, String)>, stdin: String, stdout: String, @@ -113,6 +114,11 @@ fn op_run( c.arg(arg); }); cwd.map(|d| c.current_dir(d)); + + if run_args.clear_env { + super::check_unstable(state, "Deno.run.clearEnv"); + c.env_clear(); + } for (key, value) in &env { c.env(key, value); } |