-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Not able to override env variables using terminal.integrated.env.osx #98490
Comments
@jahan01, do you happen to have one of the "terminal.integrated.shell.osx": "/bin/bash" Opening an integrated terminal in VS Code sources your .bash_profile if Bash is set as your shell just as Bash would normally (in fact, I believe VS Code sources your .bash_profile anyway when it starts to set up your development environment, although I could be wrong). I have two possible fixes for you to try:
|
No, by default its empty, so it uses my system default shell ZSH. I was trying with
already set and tried with both values
No, I wanted to override the variable only for this specific project, I dont want to change system wide settings. Hence I am thinking to pass Though I have a workaround, I would appreciate if it can be fixed in vscode. |
I understand your use case now. Yeah, it doesn't quite make sense for your setting not to be taken into effect. I would take a look at this comment and try to make sure VS Code is allowed to modify your terminal. You can make sure it's allowed by running Terminal: Allow Workspace Shell Configuration in the Command Palette. If that isn't able to fix your problem, I would look into using a launch.json file for your project and setting the environment like so: {
"configurations": [
{
"type": "java",
"env": {
"JAVA_HOME": "/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home"
}
}
]
} |
I also dont see that command in command palate, but I got a prompt which asked me to allow workspace to set shell configs, to which I clicked yes. I am repeating here, it doesnt work only when the same variable is also set by start scripts. The other ones, which are not set in startup scripts are working just fine. So in my case if have below settings, only "terminal.integrated.env.osx": {
"JAVA_HOME": "/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home",
"MY_CUSTOM_VAR": "my_value"
}
This does work only if you want to execute a code but here I want to run built tools like I have a workaround myself which I have specified in my previous comment. But I dont think every vscode user can use that, as it requires people to be familiar with concepts of start scripts and rcfile. So having this fixed in vscode will be useful for every user. |
I also got this error on my mac. But when I launch vscode using |
This changed to
This is working 100% as designed, |
@Tyriar: i have project specific env variable which needs to override global one. turns out it is a common use case with the people I talk to. Is it possible to support something on the lines of how I was trying to suggest if this feature is available in the core not every extension like |
@jahan01 the way the Python extension does it is bad as it could fail and you would never know and spams the screen on launch, I'm trying to get them to adopt a new API to do away with sending a command after the terminal has launched microsoft/vscode-python#11039 I recommend switching your startup scripts to include a condition around |
@Tyriar thanks for your suggestion |
Steps to Reproduce:
.zshenv
or.bash_profile
depending on your default shell):settings.json
asDoes this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered: