From 2ac031d6fd3cb9b98ffb1801033d96675291f577 Mon Sep 17 00:00:00 2001 From: Leo K Date: Wed, 4 Aug 2021 21:47:43 +0200 Subject: feat(unstable): clean environmental variables for subprocess (#11571) This commit adds "Deno.RunOptions.clearEnv" option, that allows to clear environmental variables from parent process before spawning a subprocess. --- cli/dts/lib.deno.ns.d.ts | 4 ++++ cli/dts/lib.deno.unstable.d.ts | 8 ++++++++ 2 files changed, 12 insertions(+) (limited to 'cli/dts') diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts index 37cc58ad6..e1aff59fc 100644 --- a/cli/dts/lib.deno.ns.d.ts +++ b/cli/dts/lib.deno.ns.d.ts @@ -2034,6 +2034,10 @@ declare namespace Deno { * Subprocess uses same working directory as parent process unless `opt.cwd` * is specified. * + * Environmental variables from parent process can be cleared using `opt.clearEnv`. + * Doesn't guarantee that only `opt.env` variables are present, + * as the OS may set environmental variables for processes. + * * Environmental variables for subprocess can be specified using `opt.env` * mapping. * diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts index 0ac829463..6fbd13f5f 100644 --- a/cli/dts/lib.deno.unstable.d.ts +++ b/cli/dts/lib.deno.unstable.d.ts @@ -791,6 +791,14 @@ declare namespace Deno { mtime: number | Date, ): Promise; + export function run< + T extends RunOptions & { + clearEnv?: boolean; + } = RunOptions & { + clearEnv?: boolean; + }, + >(opt: T): Process; + /** **UNSTABLE**: The `signo` argument may change to require the Deno.Signal * enum. * -- cgit v1.2.3