Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WSL]: code . better error when 'cmd.exe' is not on the path #170

Closed
andreialecu opened this issue May 6, 2019 · 6 comments
Closed

[WSL]: code . better error when 'cmd.exe' is not on the path #170

andreialecu opened this issue May 6, 2019 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded wsl Issue in vscode-remote WSL
Milestone

Comments

@andreialecu
Copy link

Issue Type: Bug

Running:

"/c/Users/<username>/AppData/Local/Programs/Microsoft VS Code Insiders/bin/code-insiders" .

This is printed in the console before Code starts, it's a message that I'm not seeing in stable Code:

/c/Users/<username>/AppData/Local/Programs/Microsoft VS Code Insiders/bin/code-insiders: line 29: cmd.exe: command not found

Code Insiders will open, but the project will be opened from the Windows path (X:\dir\dir, instead of /x/dir/dir), without Remote-WSL.

This is likely to break various tooling and workflows relying on the command line.

VS Code version: Code - Insiders 1.34.0-insider (473af338e1bd9ad4d9853933da1cd9d5d9e07dc9, 2019-05-01T00:22:05.899Z)
OS version: Windows_NT x64 10.0.17763

@andreialecu
Copy link
Author

Actually, it seems this is because /c/Windows/System32 isn't in my WSL path. After adding it to the PATH env, it works properly.

Perhaps a friendlier error message about what to do would be a good addition. I feel I'm not the only person in the world to do this: microsoft/WSL#1493

@isidorn isidorn assigned aeschli and unassigned isidorn May 6, 2019
@aeschli aeschli changed the title Remote-WSL: code . via WSL shell opens via Windows path without WSL support [WSL]: code . better error when 'cmd.exe' is not on the path May 6, 2019
@aeschli aeschli transferred this issue from microsoft/vscode May 6, 2019
@aeschli aeschli added the wsl Issue in vscode-remote WSL label May 6, 2019
@andreialecu
Copy link
Author

Thanks for taking note of this.

From what I can see, the cmd.exe call is just used to run the sibling code-insiders.cmd in the same directory as the code-insiders bash script. The .cmd file doesn't look particularly complicated.

Wouldn't it be better to just drop the cmd.exe call altogether and include the code from the .cmd natively in the main bash script?

I feel cmd.exe won't be on the PATH for a lot of people, and it seems like it could be fixed outright, rather than just reported to the user that he needs to take additional action.

@alexr00
Copy link
Member

alexr00 commented May 31, 2019

I removed /mnt/c/WINDOWS/system32 from my WSL path then:

$ code .
/mnt/c/Users/alros/.vscode/extensions/ms-vscode-remote.remote-wsl-0.36.0/scripts/wslCode.sh: line 12: wsl.exe: command not found
Visual Studio Code for WSL currently only supports the default distro. Use 'wslconfig.exe' to configure the default distro.

That message doesn't explain that the path is missing something.

@alexr00 alexr00 reopened this May 31, 2019
@alexr00 alexr00 added the verification-found Issue verification failed label May 31, 2019
@aeschli aeschli modified the milestones: May 2019, June 2019 Jun 3, 2019
@aeschli aeschli closed this as completed Jun 26, 2019
@alexr00
Copy link
Member

alexr00 commented Jun 27, 2019

Now I'm getting an exception:

alros@ALROS-1:/mnt/c/Users/alros/Documents/empty1$ code-insiders .
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: spawn cmd.exe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)

@alexr00 alexr00 reopened this Jun 27, 2019
@aeschli aeschli modified the milestones: June 2019, July 2019 Jun 28, 2019
@aeschli
Copy link
Contributor

aeschli commented Jul 30, 2019

fixed by microsoft/vscode@49b51b3

@aeschli aeschli closed this as completed Jul 30, 2019
@weinand
Copy link

weinand commented Jul 31, 2019

@aeschli After removing /mnt/c/WINDOWS/system32 from the WSL PATH, "code" and "code-insiders" starts up fine, but the following message shows up in the terminal:

wsl.exe not found on PATH, unable to probe wheter this is the default distro

IMO the message is self-explanatory (but contains a typo "wheter").

@weinand weinand added verified Verification succeeded and removed verification-found Issue verification failed labels Jul 31, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded wsl Issue in vscode-remote WSL
Projects
None yet
Development

No branches or pull requests

5 participants