Skip to content

Tasks.json options - env not works in WSL  #114336

@dilin-MS

Description

@dilin-MS

Environment variables can not be passed in when runs task if my VS Code use WSL as default shell.

Version: 1.52.1 (user setup)
Commit: ea3859d
Date: 2020-12-16T16:34:46.910Z
Electron: 9.3.5
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.19042

Steps to Reproduce:

  1. Have the following task in .vscode/tasks.json
        {
            "label": "test env",
            "type": "npm",
            "path": "tabs/",
            "script": "test",
            "options": {
                "env": {
                    "test_abc": "123"
                }
            }
        },
  2. Have the following script in ./tabs/package.json
  "scripts": {
    "test": "echo $test_abc"
  },
  1. Trigger command pallate "Task: Run task" and select "test env" task. The following output shows the environment variable is not passed into the script:
> Executing task: npm run test <


> microsoft-teams-ext@0.1.0 test /mnt/c/Users/dilin/Downloads/test/local-debug-test/test0114/tab-rc11/tabs
> echo $test_abc



Terminal will be reused by tasks, press any key to close it.

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalitytasksTask system issues

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions