Skip to content

Add WSL Support - #5379

Closed
dlloyd123 wants to merge 21 commits into
desktop:developmentfrom
dlloyd123:wsl_support
Closed

dlloyd123 wants to merge 21 commits into
desktop:developmentfrom
dlloyd123:wsl_support

Conversation

@dlloyd123

@dlloyd123 dlloyd123 commented Aug 11, 2018 •

Copy link
Copy Markdown

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.

Comment thread app/src/lib/shells/win32.ts Outdated
shells.push({
shell: Shell.WslDebian,
name: 'debian',
path: wslShellPathWindows + 'debian.exe',

This comment was marked as spam.

This comment was marked as spam.

@dlloyd123

dlloyd123 commented Aug 19, 2018 •

Copy link
Copy Markdown
Author

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"

@dlloyd123 dlloyd123 closed this Aug 19, 2018
@dlloyd123 dlloyd123 reopened this Aug 19, 2018
@dlloyd123

Copy link
Copy Markdown
Author

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)

@shiftkey

Copy link
Copy Markdown
Member

@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 yarn build:prod && yarn start:prod on Windows.

@dlloyd123

Copy link
Copy Markdown
Author

Thanks @shiftkey i will take a look - ive just merged all stuff from master in to see if that helps also

@dlloyd123

Copy link
Copy Markdown
Author

This needs some more work, ive noticed a few issues with this.

@dlloyd123

Copy link
Copy Markdown
Author

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?

@dlloyd123

Copy link
Copy Markdown
Author

@paulcbetts this is ready for review. let me know any feedback

Comment thread app/src/lib/shells/win32.ts Outdated
}

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.

Comment thread app/src/lib/shells/win32.ts Outdated
return Shell.WslBashDefault
}

if (label.search('WSL Bash') === 0) {

This comment was marked as spam.

This comment was marked as spam.

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.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment thread docs/technical/shell-integration.md Outdated
PowerShellCore = 'PowerShell Core',
Hyper = 'Hyper',
GitBash = 'Git Bash',
WslBash = 'WSL Bash (Default)',

This comment was marked as spam.

This comment was marked as spam.

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.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@outofambit
outofambit changed the base branch from master to development December 27, 2018 21:51
@shiftkey shiftkey self-assigned this Mar 24, 2019
@shiftkey shiftkey removed their assignment May 21, 2019
@shiftkey shiftkey self-assigned this May 31, 2019
@shiftkey

shiftkey commented Jun 3, 2019

Copy link
Copy Markdown
Member

@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.

@shiftkey shiftkey closed this Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants