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

Set shell: true when spawning npm commands #732

Merged
merged 9 commits into from
Apr 23, 2024

Conversation

ecraig12345
Copy link
Member

@ecraig12345 ecraig12345 commented Apr 17, 2024

Due to a Node security fix (see nodejs/node@69ffc6d50d, nodejs/node#52554) it's now necessary to pass shell: true to spawn npm on Windows. I added a test and re-enabled Windows builds to verify that this still works.

This will likely cause some perf degradation due to the extra step of spawning a shell, but it seems there's not really a way around that for Windows now.

Also removed the custom logic to resolve the npm client and the @lage-run/find-npm-client package, since that ought to be handled in the shell based on the PATH.

Fixes #733

@ecraig12345 ecraig12345 changed the title Set shell: true when spawning npm commands Set shell: true when spawning npm commands on Windows Apr 17, 2024
@fcaminada
Copy link
Contributor

Hi, can you check that this fix works when the NPM is in a folder that has whitespaces in its name (e.g. "Program Files) ?

@ecraig12345 ecraig12345 changed the title Set shell: true when spawning npm commands on Windows Set shell: true when spawning npm commands Apr 22, 2024
@ecraig12345
Copy link
Member Author

Hi, can you check that this fix works when the NPM is in a folder that has whitespaces in its name (e.g. "Program Files) ?

I got rid of the manual npm command resolution logic, so it should be fine with spaces now.

@ecraig12345 ecraig12345 enabled auto-merge (squash) April 23, 2024 22:16
@ecraig12345 ecraig12345 merged commit f324ccc into microsoft:master Apr 23, 2024
3 checks passed
@ecraig12345 ecraig12345 deleted the shell branch April 23, 2024 22:19
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.

Error: spawn EINVAL with Node v20.12.2
3 participants