Description
openedon Feb 12, 2024
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.86.1 (commit 31c37ee)
- OS Version: WSL2 (issue seems to reproduce on linux as well)
I initially posted this on stackoverflow but after some more observations, it looks like a bug to me. First, here is the basic issue. I am starting vscode using the cli web server as code serve-web
. I am using the following in settings.json
:
{
"terminal.integrated.profiles.linux": {
"my-bash": {
"path": "/usr/bin/bash",
"args": ["--noprofile", "--norc"]
},
},
"terminal.integrated.defaultProfile.linux": "my-bash"
}
To replicate my issue, put export TMP_VARIABLE=10
in /etc/profile.d/xxxx.sh
and run the following commands (on WSL/linux, not the vscode terminal).
$ export TMP_VARIABLE=3
$ export NEW_TMP_VARIABLE=100
$ code serve-web
In the vscode terminal, the newly created variable NEW_TMP_VARIABLE
appears and is set to 100
(which is what I want). But for some reason, TMP_VARIABLE
is still equal to 10
. Why is this happening?
How do I get vscode web server's terminal to use the variables in my current environment? And why does the --noprofile
option not have the desired effect?
Further observations
If I add echo 'profile.d is being read!!'
to /etc/profile.d/xxxx.sh
, this statement is output each time I open a new terminal on WSL/linux. In vscode, if I change the shell args to ["--login"]
, I can see it output in the vscode terminal as well. But with args set to ["--noprofile", "--norc"]
, I don't see this echo. However, the value of TMP_VARIABLE
is still set according to what's in /etc/profile.d/xxxx.sh
, not according to the local environment. This makes me think vscode is starting a new login shell somewhere and copying its environment over in some strange way. I'm not sure, but seems to me like there is some bug here.