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

Sanitize spawn calls which contain .cmd for win32 #1465

Merged
merged 2 commits into from
Oct 16, 2024

Conversation

Promytheos
Copy link
Contributor

@raineorshine
Copy link
Owner

There was a broken test in main that snuck in because the test was incorrectly written against live data from the npm registry that changed. I disabled it in 3f5f58a and rebased the PR branch on main so the CI result should be accurate now.

@Promytheos Promytheos force-pushed the win32-node20-support branch from cd73236 to 2c87809 Compare October 16, 2024 20:33
Copy link
Owner

@raineorshine raineorshine left a comment

Choose a reason for hiding this comment

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

Thanks!

@raineorshine raineorshine merged commit 6d446d7 into raineorshine:main Oct 16, 2024
7 checks passed
@Promytheos
Copy link
Contributor Author

Did some more digging, I'm thinking it may make sense to move away from cross spawn at some point. It hasn't been updated in the last 4 years and doesn't look like the owner is actually responding to issues or PR's. The reason this was failing is probably due to the path in __dirname is posix, which windows does not fancy. cross-spawn does some handling for that when it parses the arguments, but only if shell is not set to true (which is exactly what we want it to be). So solution might be to sanitize the paths before we call spawn. Thing is, once we go down this rabbit hole, we're effectively doing what cross-spawn does so it makes having that as a dependency less useful

@Promytheos
Copy link
Contributor Author

Promytheos commented Oct 16, 2024

TLDR; reason it failed with my fix was due to cross-spawn not parsing the options (due to {shell: true}).

Promytheos added a commit to Promytheos/npm-check-updates that referenced this pull request Oct 16, 2024
@raineorshine
Copy link
Owner

raineorshine commented Oct 16, 2024

Great, thanks for the additional research and explanation! Too bad it was not an easy fix :/

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