Open
Conversation
cd68b90 to
10521a9
Compare
10521a9 to
acd868f
Compare
LukeAbby
commented
Oct 20, 2025
Contributor
Author
LukeAbby
left a comment
There was a problem hiding this comment.
Looks like the windows failure is most likely due to the fact that I'd need to suffix pnpm with pnpm.cmd or something.
I think the better approach would be something like https://www.npmjs.com/package/cross-spawn though. It has the same API but fixes Node's deficiencies. Let me know what you think.
| shell(`${formatter} ${updatedPaths.join(" ")}`) | ||
| const command = formatter[0] | ||
| const args = formatter.slice(1) | ||
| shell(command, [...args, "--", ...updatedPaths]) |
Contributor
Author
There was a problem hiding this comment.
The extra -- is to prevent a filename named like --help from being interpreted as a flag. Arguably needs to be applied elsewhere but it gets increasingly difficult elsewhere since shell commands rarely are prepared to actually deal with dashes at the beginning of filenames in arbitrary locations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
execandexecSyncboth document:While I'm not particularly worried about inputs being malicious (they are from the user provided paths) it's still a problem because shell metacharacters like
*,",',(space), etc. would all need handling since they are legal in paths.However this is a breaking change because
formatCmdchanged from astringto astring[]. If that's unacceptable I can instead do this:formatCwd: string.execSyncwhenformatCwdis a string andspawnSyncotherwise.formatCwd: string.Or I could try to find a package that implements quoting of user input to the shell.