From 771457ec5cc4e3af6f5d64b6b8d89f1cba4d2aba Mon Sep 17 00:00:00 2001 From: Alin Sinpalean Date: Sun, 31 May 2020 13:41:52 +0200 Subject: [PATCH] Always derive from `process.env` when spawning a child process/shell execution This is useful when an extension (e.g. Nix Environment Selector) or launch configuration sets one or more environment variables. When `env` is not explicitly specified in the options passed to `child_process.spawn()` or `vscode.ShellExecution()`, then `process.env` gets applied automatically. But when an explicit `env` is set, it should inherit from `process.env` rather than replace it completely. --- editors/code/src/run.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts index 2a7a429cfa6..8e1ba83ed67 100644 --- a/editors/code/src/run.ts +++ b/editors/code/src/run.ts @@ -177,7 +177,7 @@ export function createTask(spec: ra.Runnable): vscode.Task { label: spec.label, command: spec.bin, args: spec.extraArgs ? [...spec.args, '--', ...spec.extraArgs] : spec.args, - env: spec.env, + env: Object.assign({}, process.env, spec.env), }; const execOption: vscode.ShellExecutionOptions = {