Add support for WSL Bash on Windows 10
See original GitHub issueIs your feature request related to a problem? Please describe.
Windows Subsystem for Linux has available bash
environment that’s available as an optional extra in recent versions of Windows 10.
It would be nice to light this up as an option in Desktop and let users choose this shell.
Describe the solution you’d like
The checks that Desktop need to perform should be added into app/src/lib/shells/win32.ts
and we have documentation outlining how to add support for additional shells.
The high-level steps for looking this up are basically:
- are you on Windows 10? If not, return
false
- Have you enabled WSL? This seems to be the magic registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Notifications\OptionalFeatures\Microsoft-Windows-Subsystem-Linux
and it contains these values:
If not found inthe registry, return false
- Lastly, does
C:\Windows\System32\bash.exe
exist on disk. That seems to be enough for an entry point but it’d also be nice to be able to detect that you have a Linux distro installed (otherwise you would see a prompt to visit the store and install, which is fine).
We need to ensure that it launches in the user’s repository, and I think we can lean on cwd
like this:
return spawn(pathToBashExe, [ ], {
shell: true,
cwd: path,
})
EDIT: @JordanMussi added some extra context from their setup below - feel free to use that alongside the above rules.
Teachability, Documentation, Adoption, Migration Strategy
This should all just work, but I’m not sure on the right label for this shell to prevent it from being confused with Git Bash. In the start menu you search on the Linux distro you have, which means support for multiple distros is possible - maybe that’s a stretch goal for this?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:7 (6 by maintainers)
Top GitHub Comments
@ADustyOldMuffin Go for it! ✨
@shiftkey I’d be interested in taking this over since it seems to be almost done and in need of a owner.