Skip to content

Add support for WSL shell in Windows - #6420

Closed
jayschwa wants to merge 5 commits into
desktop:developmentfrom
jayschwa:wsl-shell
Closed

jayschwa wants to merge 5 commits into
desktop:developmentfrom
jayschwa:wsl-shell

Conversation

@jayschwa

Copy link
Copy Markdown
Contributor

Overview

Closes #4641

Description

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.

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 desktop#4641

[1]: https://docs.microsoft.com/en-us/windows/wsl/wsl-config#wsl-and-wsl-command
[2]: microsoft/WSL#3515
@jayschwa

Copy link
Copy Markdown
Contributor Author

I pushed a new commit with linter fixes. Status is green now.

@outofambit
outofambit changed the base branch from master to development December 27, 2018 21:49
@billygriffin

Copy link
Copy Markdown
Contributor

Apologies for missing this @jayschwa! I'm adding ready for review now. We're working on a few others things that are pretty high priority at the moment, but hopefully we can get to this in the next couple weeks. Sorry again for the delay and our lack of response.

@billygriffin billygriffin added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Mar 7, 2019
@shiftkey shiftkey self-assigned this Mar 24, 2019
coltenkrauter
coltenkrauter previously approved these changes Apr 15, 2019
@coltenkrauter

Copy link
Copy Markdown

Can someone with write access approve this? It would be great to have this feature. 😃

@shiftkey

Copy link
Copy Markdown
Member

@coltenkrauter there are currently competing pull requests to address this - #6420 and #5379 - and I need to sit down and review both of them. I'm currently swamped with other feature and review work, but I'm aware of the interest in seeing this supported.

@coltenkrauter

Copy link
Copy Markdown

I appreciate your response, sounds good. 👍

@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

@jayschwa thanks for opening this up! I just pushed a new commit to this branch to wrap it in a feature flag, so we can control when this gets rolled out to users in case we encounter issues in the wild and need to roll it back.

I've also tested this out on Ubuntu (Windows 10.0.18362.145) and everything seems fine, but I'm going to pore over the changes next and see if I haven any other suggestions to get in here as a first iteration on this support.

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

Some initial feedback

Comment thread app/src/lib/shells/win32.ts Resolved
)
return null
}
const exitCode = new Promise<number>(resolve => {

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.

❔ Should we handle the error event emitted by the spawned process?

})
if ((await exitCode) !== 0) {
log.debug(
`[WSL] found wsl.exe and wslconfig.exe, but no distros are installed`

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.

🎨 can we add the exit code received to this error message, to help with troubleshooting environment issues?

@jayschwa

jayschwa commented Jun 5, 2019

Copy link
Copy Markdown
Contributor Author

I have switched to Linux in the months since I created this PR. I no longer have a good way to develop and test the code, so someone else will have to be its champion.

@shiftkey

shiftkey commented Jun 6, 2019

Copy link
Copy Markdown
Member

@jayschwa thanks for the update. I'll have a chat with @desktop/engineering and see what we can do about it...

@shiftkey shiftkey removed their assignment Jun 6, 2019
@shiftkey

Copy link
Copy Markdown
Member

Superseded by #7821

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