4669: Always derive from `process.env` when spawning a child process/shell execution r=matklad a=Dfinity-Alin

This is useful when an extension (e.g. [Nix Environment Selector](https://marketplace.visualstudio.com/items?itemName=arrterian.nix-env-selector)) or [launch
configuration](https://stackoverflow.com/questions/57641460/set-env-var-for-node-js-when-launching-through-vs-code) 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.

Co-authored-by: Alin Sinpalean <alin.sinpalean@dfinity.org>
This commit is contained in:
bors[bot] 2020-05-31 16:58:57 +00:00 committed by GitHub
commit 9feb15e6a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 = {