vscode: Incorrect $PATH order in task shell
Type: Bug
I have a custom task in tasks.json
. Since upgrading to 1.80 it’s loading my $PATH
env variable in an incorrect order.
I have tested this by adding this task in tasks.json
.
{
"label": "echo PATH",
"type": "shell",
"command": "echo $PATH"
},
When I run this task it shows a different $PATH
than when I choose New Terminal within VS Code and run echo $PATH
. The paths themselves appear the same, just in a different order which is causing issues with finding the proper bins.
I’m on Mac OS X 13.3 and use zsh.
VS Code version: Code 1.80.1 (Universal) (74f6148eb9ea00507ec113ec51c489d6ffb4b771, 2023-07-12T17:20:23.298Z) OS version: Darwin x64 22.4.0 Modes:
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i9-9880H CPU @ 2.30GHz (16 x 2300) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled |
Load (avg) | 2, 2, 2 |
Memory (System) | 16.00GB (0.58GB free) |
Process Argv | . --crash-reporter-id f3967eb1-1d64-41bb-a279-ee5aa5d9697f |
Screen Reader | no |
VM | 0% |
Extensions (12)
Extension | Author (truncated) | Version |
---|---|---|
vscode-toggle-quotes | Bri | 0.3.6 |
compulim-vscode-closetag | Com | 1.2.0 |
vscode-mac-color-picker | dae | 1.1.0 |
vscode-eslint | dba | 2.4.2 |
ERB Syntax | und | 0.0.1 |
prettier-vscode | esb | 9.19.0 |
batch-rename-extension | Jan | 0.0.6 |
dotenv | mik | 1.0.1 |
remote-containers | ms- | 0.299.0 |
material-icon-theme | PKi | 4.28.0 |
vscode-syntax-tree | rub | 0.5.1 |
svelte-vscode | sve | 107.8.0 |
(1 theme extensions excluded)
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263cf:30789497
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
vscccc:30610679
282f8724:30602487
pyind779:30671433
89544117:30613380
vscrp:30673768
pythonsymbol12:30671437
showlangstatbar:30737416
vsctsb:30748421
pythonms35:30701012
03d35959:30757346
pythonfmttext:30731395
pythoncmv:30756943
fixshowwlkth:30771522
showindicator:30785052
pythongtdpath:30769146
i26e3531:30780429
pythonnosmt12:30779714
pythonidxpt:30784022
pythonnoceb:30776495
h7j2d465:30786200
dsvsc013cf:30789518
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 7
- Comments: 34 (10 by maintainers)
I think this one is probably related: https://github.com/microsoft/vscode/issues/186244
I’m also adopting the
source ~/.zshrc &&
in the command workaround suggested in that linked issue, seems like the only thing that works for nowChanging the order of the path breaks a lot of things for me, it is loading system versions of things like Ruby etc instead of my local ones 😅 I tried to override the behavior with options.env.PATH but that gets blown away too.
I am a little surprised that there’s not more activity on this issue, my environment must be weirder than I thought, because I thought this would have blown a lot of people up
@meganrogge I wonder if it’s due to this commit. Not sure if this is in 1.80. https://github.com/microsoft/vscode/commit/ca9192e80b096d715378e905fc074723924bad10
It’s strange that the PR this commit references (https://github.com/microsoft/vscode/pull/186938) seems to just be for performance but the commit seems to remove fetching the shell env.
This worked as expected with the following version of vscode:
And was broken on the following version:
This is also a problem for me when using Conda python environments because the system version of python is selected instead of the version used in the environment.
macOS terminal:
Inside vscode task:
I have the same issue.
Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794
.vscode/tasks.json
Executing the task
From terminal
Current work around:
~/.zprofile
@meganrogge @Tyriar can you reopen this issue? It’s still a problem. What information do you need from me to help resolve it?
@ryanb in which case I think it is expected since the builtin git extension uses this API