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.
This commit is contained in:
Alin Sinpalean 2020-05-31 13:41:52 +02:00
parent 09df51dab8
commit 771457ec5c

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