microsoft / vscode

Visual Studio Code

Home Page:https://code.visualstudio.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use Windows Subsystem for Linux as integrated terminal

NCC1701M opened this issue · comments

  • VSCode Version: 1.10.2
  • OS Version: Win10 1607

Steps to Reproduce:

  1. Set the following settings in VSCode
    "terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe",
    "terminal.external.windowsExec": "C:\\Windows\\System32\\bash.exe"
  2. Try to start a new terminal

You get the following error message:
The terminal process command C:\Windows\System32\bash.exe failed to launch (exit code: 1)

Try this:

"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe"

https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration

With the Fall Creators Update this is changed.
"C:\\Windows\\System32\\bash.exe" personally doesn't work - I'm assuming this isn't a left over from the old one.

The full application link is required :
"terminal.integrated.shell.windows": "C:\\Windows\\WinSxS\\amd64_microsoft-windows-lxss-bash_31bf3856ad364e35_10.0.16299.15_none_62878a822db68b25\\bash.exe"

Note:
I'm not sure if this folder will have a different name for other users (significance of the alphanumerics after "none"?), looks like it will change with each version...personally not well versed on Win10 apps so couldn't say either way.

@Drache93 I'm on the Fall Creators Update and this works fine for me:

"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe"

Sorry didn't make this clear. I'm using the new Ubuntu distro from the Windows Store. Rather than the old Bash on Windows. Is this the same for you @Tyriar?

Not sure I've tried on a PC without Bash on Windows installed via the older mechanism, so not sure. If that is the new recommended path it's not particularly nice. @bitcrazed is it true that users will need to use a path like this when hooking up Ubuntu installed via the store?

"terminal.integrated.shell.windows": "C:\\Windows\\WinSxS\\amd64_microsoft-windows-lxss-bash_31bf3856ad364e35_10.0.16299.15_none_62878a822db68b25\\bash.exe"

Thanks @Tyriar .

@Drache93 - When using new store-delivered distros, one can be configured as your default - this is the distro that gets launched when you call bash.exe or wsl.exe. You can configure which distro you want to set as your default using wslconfig.exe.

If you're calling from a 32-bit process, you'll need to reference via sysnative: C:\\Windows\\sysnative\\bash.exe as @Tyriar suggested above.

If you're configuring VSCode 64bit edition, you can directly reference C:\\WINDOWS\\System32\\bash.exe or C:\\WINDOWS\\System32\\wsl.exe

If you wanted to specifically instantiate a given distro, just call ubuntu.exe or openSUSE-42.exe or SLES-12 (no absolute paths needed - they'll already be on your OS path).

HTH.