microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.89k stars 8.34k forks source link

WSL profile matching fails to work if launched from start menu #12582

Open lhecker opened 2 years ago

lhecker commented 2 years ago

Windows Terminal version

1.14.552.0

Windows build number

10.0.22559.0

Steps to reproduce

Expected Behavior

My WSL profile gets matched.

Actual Behavior

WSL profile doesn't get matched.

Cause

The start menu entry was changed to be a direct link to the WSL app package and is this for instance:

C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemforLinux_0.51.3.0_x64__8wekyb3d8bbwe\wsl.exe

Addenda

Probably the same thing for distro-shipped executables, like ubuntu.exe, if that's at all possible. It might not be - we can't always be sure what the exe is going to be, or if the exe shipped by a distro actually is the launcher, or something else

Limyx826 commented 1 year ago

I am having the same issue as well. Just notify it still exist. Terminal Version: 1.17.11461.0 Windows 10 22H2 build 19045.3208.

zadjii-msft commented 2 months ago

Similarly:

Notably, win+r -> wsl -d ubuntu-22.04 launches in my default profile, but c:\windows\system32\wsl -d ubuntu-22.04 does launch in my ubuntu profile (the one the Terminal makes)

That's almost the inverse of this bug.

https://github.com/microsoft/terminal/blob/17a55da0f9889aafd84df024299982e7b94f5482/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp#L657C34-L725

That won't match commandlines that are only missing characters at the start from a commandline.

C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemforLinux_0.51.3.0_x64__8wekyb3d8bbwe\wsl.exe -d ubuntu-22.04  # commandline from Start Menu
                                                                                                         wsl.exe -d ubuntu-22.04  # commandline from run dialog, devhome
                                                                                     c:\windows\system32\wsl.exe -d ubuntu-22.04  # commandline in profile

xlink