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

fix: windows shell #9

Closed
wants to merge 1 commit into from
Closed

fix: windows shell #9

wants to merge 1 commit into from

Conversation

Eomm
Copy link

@Eomm Eomm commented May 27, 2019

The snippet in example.js doesn't work on windows platform with this setup:
(from git-bash)

echo $PATH
/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Program Files/Microsoft VS Code/bin
echo $EDITOR
code
echo $COMSPEC
C:\WINDOWS\system32\cmd.exe

For what I read from docs, this is caused by windows that require some adjustments on the spawn command in order to works properly:

  • based on the editor, there should be a "binary windows" that could be:
    childProcess.spawn(${result.binary}.cmdorchildProcess.spawn(${result.binary}.exe
  • the easiest is this PR, that add shell: process.platform === 'win32' parameter so the command will be executed in a standalone shall

A related issue on node.js (since vscode is an electron app)
nodejs/node#15217

I would appreciate your thought about this PR.
Thank you very much

@sindresorhus
Copy link
Owner

Using the shell option is almost always the wrong answer. You could maybe try using https://github.com/sindresorhus/execa instead of child_process.spawn here and see if that fixes it. That module have many things to make it work better on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants