Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evironment variables not expanding in tasks #72029

Closed
robertcampion opened this issue Apr 9, 2019 · 6 comments
Closed

Evironment variables not expanding in tasks #72029

robertcampion opened this issue Apr 9, 2019 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release tasks Task system issues verified Verification succeeded

Comments

@robertcampion
Copy link

Environment variables (of the form ${env:name}) are not expanding, or are expanding to the empty string, when occurring in tasks.json. This was working as of about a week ago, but didn't work today.

  • Version: 1.33.0 (user setup)
  • Commit: 0dd516d
  • Date: 2019-04-04T15:14:28.026Z
  • OS: Windows_NT x64 10.0.17763

Also tested in the Insiders build:

  • Version: 1.34.0-insider (user setup)
  • Commit: 56f1b47
  • Date: 2019-04-09T05:19:45.294Z

Steps to Reproduce:

  1. Create a new empty folder; add .\.vscode\tasks.json with the following contents:
    {
        "version": "2.0.0",
        "tasks": [
            {
                "label": "echo path",
                "type": "shell",
                "command": "Write-Host ${env:PATH}",
            }
        ]
    }
    
  2. Run this task (Ctrl+Shift+P, Tasks: Run Task, echo path); the output is:
    > Executing task: Write-Host  <
    
    Terminal will be reused by tasks, press any key to close it.
    
    i.e. the environment variable expands to the empty string.
  3. Run the same command in the terminal (Ctrl+Shift+`, run Write-Host ${env:PATH}); the system path is printed.

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

@vscodebot vscodebot bot added the tasks Task system issues label Apr 9, 2019
@alexr00 alexr00 added the bug Issue identified by VS Code Team member as probable bug label Apr 10, 2019
@alexr00
Copy link
Member

alexr00 commented Apr 10, 2019

I can repro, thank you for providing clear repro steps/examples.

@alexr00 alexr00 added the candidate Issue identified as probable candidate for fixing in the next release label Apr 10, 2019
@alexr00 alexr00 added this to the March 2019 Recovery milestone Apr 10, 2019
@weinand
Copy link
Contributor

weinand commented Apr 10, 2019

On Windows the path env variable is "Path" and not "PATH", right?

@alexr00
Copy link
Member

alexr00 commented Apr 10, 2019

Neither Path or PATH work now in tasks. Both used to work.

@weinand
Copy link
Contributor

weinand commented Apr 10, 2019

Both "Path" or "PATH" work fine in a launch config on Windows:

{
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "args": ["-e", "console.log(process.argv[1]);", "${env:PATH}"]
        }
    ]
}

@alexr00
Copy link
Member

alexr00 commented Apr 10, 2019

Caused by 900d58b

@weinand
Copy link
Contributor

weinand commented Apr 11, 2019

@alexr00 please close if it's fixed.

@alexr00 alexr00 closed this as completed Apr 11, 2019
@dbaeumer dbaeumer added the verified Verification succeeded label Apr 11, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators May 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release tasks Task system issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants