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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve child process spawning #818

Merged
merged 7 commits into from
Apr 13, 2020

Conversation

RaeesBhatti
Copy link
Contributor

- Summary
If the path to binary is not quoted on Windows and contains a space, it will get the path wrong and fail. This change makes sure that the path to app binary is quoted.
Fixes: #817

- Test plan

  • Have your app binary in path with spaces
  • Run netlify dev

- Description for the changelog
Quote app binary path before spawning it.

- A picture of a cute animal (not mandatory but encouraged)
馃惉

@ehmicky
Copy link
Contributor

ehmicky commented Apr 13, 2020

Note: an alternative would be not to use shell: true. This means users won't be able to use shell features like $variable expansion or globbing, but it also means no escaping issues. It also is safer. See more information.

@RaeesBhatti RaeesBhatti changed the title Dev: Quote command binary path to make it space safe Improve child process spawning Apr 13, 2020
@RaeesBhatti
Copy link
Contributor Author

Thanks for the tip @ehmicky. I attempted that yesterday but could make the addons tests work on Windows. Found out the problem today, we were trying to invoke a JS file without shell, which isn't supported. Updated now. Please take another look!

stdio: settings.stdio || 'inherit',
detached: true,
shell: true,
stdio: 'pipe',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for settings.command to ask for interactive input from the user?
If so, stdio: 'pipe' would not work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we do process.stdin.pipe(ps.stdin)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented here: #823

@RaeesBhatti RaeesBhatti merged commit 48d18b4 into master Apr 13, 2020
@RaeesBhatti RaeesBhatti deleted the raees/windows-path-space-problem-fix branch April 13, 2020 12:59
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.

netlify dev: 'C:\Program' is not recognized as an internal or external command
2 participants