Vscode-remote-release: Command is only available in WSL or inside a Visual Studio Code terminal.

Created on 27 Jul 2019  Â·  4Comments  Â·  Source: microsoft/vscode-remote-release

  • VSCode Version: 1.36.1
  • Local OS Version: 18945.1001
  • Remote OS Version: 4.19.55-microsoft-standard
  • Remote Extension/Connection Type: WSL

Steps to Reproduce:

  1. Open a new wsl shell by running cmd.exe and typing "wsl"
  2. Run code from ~/.vscode-server/bin/2213894ea0415ee8c85c5eea0d0ff81ecc191529/bin/code

Result:
➜ ~ ./.vscode-server/bin/2213894ea0415ee8c85c5eea0d0ff81ecc191529/bin/code
Command is only available in WSL or inside a Visual Studio Code terminal.
➜ ~ uname -a
Linux DESKTOP-D77SSSS 4.19.55-microsoft-standard #1 SMP Fri Jun 28 20:53:12 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
➜ ~

*as-designed

Most helpful comment

So in order to open my project in vscode I have to open vscode, create a terminal window, and run code /path/to/project so that it opens in another vscode window? What's the point of having a command line interface then if it doesn't save any time?

All 4 comments

This is correct the 'vs code server CLI' is only available from the integrated terminal.

Despite it's "as designed", this particular behavior doesn't let to e.g. run a "git pull" command from a separate terminal window (not from the VSCode's terminal). It asks for git username/password in this case, even if the path to bin/code tool is added to $PATH.

The concrete usecase: while using Remote Containers extension, git commands transparently work with stored credentials (credential.helper) in the vscode terminal, but don't work when manually run in "docker-compose exec server bash" terminal outside of vscode. This is way inconvenient: many people prefer their own terminal programs (like iTerm2 for MacOS) instead of vscode's terminal.

Is there any chance you'll let the code tool to work in external terminals too? How does it detect that the terminal is "external" and not the vscode's one? (I think it does it through VSCODE_IPC_HOOK_CLI environment variable, is there a way to make this variable appear in external terminals too?)

...here is a hack I had to apply in devcontainer.json to make the code tool work:

"postCreateCommand": "(echo 'export PATH=`echo ~/.vscode-server/bin/*/bin`:$PATH'; echo 'export VSCODE_IPC_HOOK_CLI=`echo /tmp/vscode-ipc-*.sock`') >> ~/.bashrc"

So in order to open my project in vscode I have to open vscode, create a terminal window, and run code /path/to/project so that it opens in another vscode window? What's the point of having a command line interface then if it doesn't save any time?

Was this page helpful?
0 / 5 - 0 ratings