Skip to content

Can't override shell on wsl.exe call #4296

Closed

Description

@max06
  • Your Windows build number: 18362.239

  • What you're doing and what's happening:
    I'm using the Ubuntu-18.04 image from the microsoft store (wsl v1), added fish and made it my default shell using chsh -s /usr/bin/fish. Works so far.
    Today I tried to use VScode with the remote development extension, configuring it for WSL. After starting it, vscode shows an error and prints following output in a terminal:

[2019-07-11 08:24:12.789] Starting VS Code Server inside WSL (Ubuntu-18.04)
[2019-07-11 08:24:12.789] Extension version: 0.38.9, Windows build: 18362. Multi distro support: enabled. WSL path support: enabled
[2019-07-11 08:24:13.093] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe -d Ubuntu-18.04 bash -c "[ -d ~/.vscode-server/bin/2213894ea0415ee8c85c5eea0d0ff81ecc191529 ] && echo found || echo missing"
[2019-07-11 08:24:13.847] Server install found in WSL
[2019-07-11 08:24:13.847] Launching C:\WINDOWS\System32\wsl.exe -d Ubuntu-18.04 bash -c "'$(wslpath -u 'c:/Users/max06/.vscode/extensions/ms-vscode-remote.remote-wsl-0.38.9/scripts/wslServer.sh')' '2213894ea0415ee8c85c5eea0d0ff81ecc191529' 'stable' '.vscode-server' '' 0  " in c:\Users\max06\.vscode\extensions\ms-vscode-remote.remote-wsl-0.38.9
[2019-07-11 08:24:14.623] fish: $(...) is not supported. In fish, please use '(wslpath)'.
[2019-07-11 08:24:14.623] bash -c "'$(wslpath -u 'c:/Users/max06/.vscode/extensions/ms-vscode-remote.remote-wsl-0.38.9/scripts/wslServer.sh')' '2213894ea0415ee8c85c5eea0d0ff81ecc191529' 'stable' '.vscode-server' '' 0  "
[2019-07-11 08:24:14.623]           ^
[2019-07-11 08:24:14.623] VS Code Server for WSL closed unexpectedly.
[2019-07-11 08:24:14.623] For help with startup problems, go to
[2019-07-11 08:24:14.623] https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
  • What's wrong / what should be happening instead:
    As I understand the output, vscode is launching a terminal calling wsl with bash -c as command. Somehow it still ends up in fish.
    When I change my default shell back to bash, it works without issues.

There's a high chance I missunderstood the concept here, in that case I'm happy about an explanation. Or I just missed a small little detail... anyways: Thanks for taking care!

Activity

  1. benhillis commented on Jul 11, 2019

    @benhillis
    Member

    This is an issue with VsCode. They should not be using bash -c to launch their vscode remote script, they should be using /bin/sh.

  2. max06 commented on Jul 11, 2019

    @max06
    Author

    Ben Hillis (@benhillis)
    Thank you for your reply.

    Just wondering: wsl.exe should call the argument provided, in this case bash -c "...". Even trying this in a regular command promt, I end up in fish, not bash.

    Example:

    C:\Users\max06>wsl.exe bash -c "ps"
      PID TTY          TIME CMD
     1915 tty4     00:00:00 fish
     2225 tty4     00:00:00 ps
    

    I can call bash directly, without wsl.exe and I end up in bash.

    Edit: Going one step further:

    C:\Users\max06>wsl.exe bash
    max06@BIEST:/mnt/c/Users/max06$ ps
      PID TTY          TIME CMD
     2837 tty4     00:00:00 fish
     3147 tty4     00:00:00 bash
     3441 tty4     00:00:00 ps
    

    That means wsl opens my default shell and executes the command in there then?

  3. benhillis commented on Jul 11, 2019

    @benhillis
    Member

    Flo (@max06) - Wsl always uses your default shell when launching processes, unless you specify the -e option, for example:

    wsl.exe -e bash -c ps

  4. max06 commented on Jul 11, 2019

    @max06
    Author

    Ben Hillis (@benhillis) - That's good to know! I'll include this in the issue I'm currently writing in the vscode-project.

    Thank you very much!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions