Repository navigation
Add WSL Support - #5379
Add WSL Support#5379dlloyd123 wants to merge 21 commits into
Conversation
Added support for all linux WSL distro variants
| shells.push({ | ||
| shell: Shell.WslDebian, | ||
| name: 'debian', | ||
| path: wslShellPathWindows + 'debian.exe', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Im going to close this for now, its a lot more tricky than anticipated and i need to re-think some things - will re-open one once its "improved" |
|
There is a unit test (integration) failing and its exhibiting the same behaviour on master (of my fork) im not 100% sure why its failing! (currently investigating) |
|
@dlloyd123 that's the launching of the app test - given it's affecting both Windows builds maybe there's something to it. You might be able to see the behaviour yourself by running |
|
Thanks @shiftkey i will take a look - ive just merged all stuff from master in to see if that helps also |
|
This needs some more work, ive noticed a few issues with this. |
|
Ok i think i've fixed the issue i was seeing and did some final tidy up. @paulcbetts care to take a look over this? |
|
@paulcbetts this is ready for review. let me know any feedback |
| } | ||
|
|
||
| if (label.search('WSL Bash') === 0) { | ||
| const foundShell: IFoundShell<Shell> | undefined = WslShells.find( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| return Shell.WslBashDefault | ||
| } | ||
|
|
||
| if (label.search('WSL Bash') === 0) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| const hkeyCurrentUser = 'HKEY_CURRENT_USER' | ||
| const keyPath = `${hkeyCurrentUser}\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Lxss` | ||
|
|
||
| // forced to used reg.exe to enumerate folder names as registry-js doesnt support folders |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| PowerShellCore = 'PowerShell Core', | ||
| Hyper = 'Hyper', | ||
| GitBash = 'Git Bash', | ||
| WslBash = 'WSL Bash (Default)', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| export const Default = Shell.Cmd | ||
| const WslShells: Array<IFoundShell<Shell>> = [] | ||
|
|
||
| export const Default: string = Shell.Cmd |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@dlloyd123 thanks for opening this up, and apologies for taking so long to revisit this work! Because of the changes required to support multiple WSL shells that this PR introduces, I'm going to focus on landing #5379 which, while it doesn't support everything that this PR does, will help us to ship something sooner to better understand what our WSL support should look like. This PR will be a great help for us to understand the extra things we could support in the future, and how to refine the abstractions we're currently carrying around in the codebase. |
Added support for all linux WSL Distro variants (Ubuntu, Debian, kali, SLES-12, openSUSE-42).
I added a pre process step to get the WSL distro install names/paths from the registry - this forced me to use reg.exe as the registry-js doesn't support enum of folders from the registry
Firstly checks the machine is windows 10 and is running a release id which supports WSL, and checks that WSL is installed via a registry check.
It then calls the command line utility wslconfig with the list param (/list) and parses the output to determine which distro is installed and correctly configured. Unconfigured distro's will appear on disk, but not be part of this list - hence using this check.
Added support for custom distro installs (suggestion from @paulcbetts ) - this forced me to alter the Shell return types and params to strings to parse the string correctly for distro variants - so we actually display the correct names. I added a name field to the IFoundShell interface to enable me to store the parsed names. I am a little unhappy about this as its forced a few things but i will tidy up.