Repository navigation
Description
Is 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-Linuxand it contains these values:
If not found inthe registry, return false
- Lastly, does
C:\Windows\System32\bash.exeexist 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?



Activity
JordanMussi commentedon May 9, 2018
There is also
C:\Windows\System32\wsl.exewhich is my preferred entry overbashsince it respects using a shell other than/bin/bash(see more below). I prefer executing the command within Hyper rather than using the terminal window theexes launch themselves. Supporting this would add unnecessary complexity and it isn't much effort to choose the desired terminal as the shell to launch in GitHub and then launch the shell manually from there.It looks like using the name of the distro as a command launches the correct shell.
wslconfig /listcan be used to find which distros are installed (once the app knows WSL is installed).As you can see above, I only have Ubuntu installed, I've just tested using
ubuntuand it is slightly different towsland bash. Note that the increased time forwsl/ubuntuis due to launching ZSH.bashandwsllaunch with a pwd of the path launched from butubuntudoes not (I tried this advice using thestartcommand butubuntustill launches to~). This limitation is actually mentioned on the linked documentation page:wslandubunturespect the default shell chosen withchshbutbashlaunches/bin/bashRunning
where ubuntu.exeincmd.exegives me the pathC:\Users\Jordan\AppData\Local\Microsoft\WindowsApps\ubuntu.exeso I presume the other distributions' launchers will land there too. However I'm not sure how reliably the executable name can be determined from thewslconfig /listcommand since there doesn't seem to be a strict naming scheme. Sure you can assume it's the name given but lower case, except this might not be true for future distributions.shiftkey commentedon May 9, 2018
@JordanMussi thanks for that extra context!
minonl commentedon Jun 21, 2018
@shiftkey Does this issue and #4657 actually enable us to start github client from WSL directly?
Currently when execue in WSL(and WSL inside Hyper) fails:
shiftkey commentedon Jun 21, 2018
@minvedacat that's a separate issue to this (please open an issue so we're tracking it).
This is the script, but I didn't test it from WSL at the time I was working on it. It works from Git Bash, so I'd love to get to the bottom of what's different between the two as that error doesn't make sense to me at first glance.
jayschwa commentedon Jan 8, 2019
#6420 is waiting for review. cc @shiftkey
ADustyOldMuffin commentedon Jun 14, 2019
@shiftkey I'd be interested in taking this over since it seems to be almost done and in need of a owner.
tierninho commentedon Jun 14, 2019
@ADustyOldMuffin Go for it! ✨