Skip to content

Commit 771457e

Browse files
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.
1 parent 09df51d commit 771457e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

editors/code/src/run.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export function createTask(spec: ra.Runnable): vscode.Task {
177177
label: spec.label,
178178
command: spec.bin,
179179
args: spec.extraArgs ? [...spec.args, '--', ...spec.extraArgs] : spec.args,
180-
env: spec.env,
180+
env: Object.assign({}, process.env, spec.env),
181181
};
182182

183183
const execOption: vscode.ShellExecutionOptions = {

0 commit comments

Comments
 (0)