Skip to content

Add support for WSL shell in Windows - #7821

Merged
shiftkey merged 19 commits into
desktop:developmentfrom
ADustyOldMuffin:wsl-shell-feat
Jun 25, 2019
Merged

shiftkey merged 19 commits into
desktop:developmentfrom
ADustyOldMuffin:wsl-shell-feat

Conversation

@ADustyOldMuffin

Copy link
Copy Markdown
Contributor

Overview

Closes #4641

Description

Written by @jayschwa on #6420

The shell is invoked with wsl.exe, which uses whichever Linux distribution the user has configured as their default. 1

The option is presented to the user when the following conditions are met:

1. `wsl.exe` and `wslconfig.exe` are both found in the system.

2. `wslconfig.exe /list` returns an exit code of zero.

I verified that wslconfig.exe /list returns a non-zero exit code when the system has no Linux distributions installed. I decided to avoid the registry for detection since that has been discouraged by the WSL developers. 2

Release notes

Notes: Adds support for WSL shell in Windows.

jayschwa and others added 9 commits December 15, 2018 13:35
The shell is invoked with `wsl.exe`, which uses whichever Linux
distribution the user has configured as their default. [1]

The option is presented to the user when the following conditions
are met:

1. `wsl.exe` and `wslconfig.exe` are both found in the system.
2. `wslconfig.exe /list` returns an exit code of zero.

I verified that `wslconfig.exe /list` returns a non-zero exit code
when the system has no Linux distributions installed. I decided to
avoid the registry for detection since that has been discouraged
by the WSL developers. [2]

Closes #4641

[1]: https://docs.microsoft.com/en-us/windows/wsl/wsl-config#wsl-and-wsl-command
[2]: microsoft/WSL#3515
I think this is better rather than just returning NULL we can get a log of what happened.
@ADustyOldMuffin

Copy link
Copy Markdown
Contributor Author

I created this PR as the original author said he could no longer champion it so I wanted to help out and work on it (sorry if there's a better way to do this 😳).

As per the original PR I added the exit code to the error message, along with an extra log when the wslPath returns null just for some extra visibility as to what happened.

I also added a reject call when the process is spawned, but I need to test it and make sure the error is actually handled as the documentation mentions that it's possible to have some weird behavior.

@shiftkey shiftkey assigned shiftkey and unassigned shiftkey Jun 20, 2019
@shiftkey shiftkey changed the title [WIP] Add support for WSL shell in Windows Add support for WSL shell in Windows Jun 21, 2019
@shiftkey shiftkey added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jun 21, 2019

@shiftkey shiftkey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one change to improve our error handling, everything else tests great on the latest WSL2 builds in Windows 10.

Comment thread app/src/lib/shells/win32.ts Resolved
@ADustyOldMuffin

Copy link
Copy Markdown
Contributor Author

I also managed to get up and running with WSL finally and tested it on the current WSL and everything seems to check out in Windows 10.

shiftkey
shiftkey previously approved these changes Jun 21, 2019
@shiftkey

Copy link
Copy Markdown
Member

Thanks for helping to get this across the line @ADustyOldMuffin!

And thanks @jayschwa for laying the groundwork!

@shiftkey

Copy link
Copy Markdown
Member

This is still feature-flagged for development, so I'm going to merge this in so we can do more testing and then figure out when we want to enable it for beta to gather more feedback.

@shiftkey
shiftkey merged commit 21b03e8 into desktop:development Jun 25, 2019

@DollFaceBabyDFBN8HOHMS66 DollFaceBabyDFBN8HOHMS66 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for WSL Bash on Windows 10

4 participants