-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Terminal env vars (WT_SESSION
, etc) aren't set when set as the Default Terminal
#13006
Comments
WT_SESSION
, etc) aren't set when set as the Default Terminal
Notes:
That summarizes the issue at hand, and a proposed solution. We think this'll require some additional OS side changes (but it would be great if it didn't) |
The same seems to apply to environment variables defined in |
+1 on this. Do this:
This breaks console apps (e.g. those built with Terminal.Gui) that are trying to determine if they are running in WT by checking for WT_SESSION. This bug also applies when running console apps in the VS 2022 debugger because WT_SESSION is not set there either. |
The better way to check what terminal default is set is read Windows registry, see https://support.microsoft.com/en-us/windows/command-prompt-and-windows-powershell-for-windows-11-6453ce98-da91-476f-8651-5c14d5777c20. |
No, checking the registry only helps determine the default terminal. This does not help code determine what terminal it is running in. The WT team needs to fix this bug that's causing WT_SESSION to not be set. |
I have one doubt here. And if you have ope your application with |
Sorry about my confusion. Run |
This commit deletes the is_Windows_Terminal funcref added in 6390072; The lambda's definition was incorrect, e.g. after starting "Command Prompt" from the Windows 11 Start Menu the lambda would return false even when Windows Terminal was being used. (See microsoft/terminal#13006. microsoft/terminal#6269 (comment) claims to have code to check whether a program is running in Windows Terminal or not.) There may be some Windows terminal programs that only support 16 colors, but that's not relevant to me.
Windows Terminal version
1.12.10983.0
Windows build number
10.0.22000.0
Other Software
No response
Steps to reproduce
Change settings to launch terminal instead of command shell.
Close instances of terminal
Run powershell/pwsh
Check $env:WT_PROFILE_ID
See that it is blank
Expected Behavior
$ENV:WT_PROFILE_ID should never be blank, because having a blank profile ID disables changing settings for that profile.
Actual Behavior
$ENV:WT_PROFILE_ID is not set when terminal is launched with pwsh/powershell, after changing system settings.
The text was updated successfully, but these errors were encountered: