Skip to content

Environment from extensionHost debug configuration is not inherited by vscode.ShellExecution tasks #241078

@eliericha

Description

@eliericha

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.97.2
  • OS Version: macOS 14.6.1

Steps to Reproduce:

  1. Define an extensionHost debug configuration with environment variables specified in env or envFile.
  2. Write code in the extension or tests that spawns a vscode.ShellExecution task that makes use of the above environment variables.
  3. Observe that the spawned task does not inherit the environment variables from the debug configuration, contrary to the documentation of vscode.ShellExecutionOptions which states that by default the parent process environment is inherited.

I created a self-contained workspace with the above steps already prepared. All you have to do is to run the Run Extension Tests debug configuration defined in launch.json to observe the problem.

I suspect that the issue is that the vscode.ShellExecution implementation caches process.env too early, before the environment variables of the debug configuration were applied.

I hope this helps.

Thanks!

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugconfirmation-pendingtasksTask system issuesterminal-processProblems launching processes, managing ptys, exiting, process leaks, etc.verifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions