Repository navigation
fix: resolve relative commands with custom cwd in Worker threads - #183
Open
vhinayindia wants to merge 1 commit into
Open
vhinayindia wants to merge 1 commit into
vhinayindia wants to merge 1 commit into
Conversation
|
Hi @vhinayindia !!! Sadly this package is no longer mantained be the creator, but if you are interested, I ported your fix to cross-spawn-esm, my ESM/TypeScript drop-in replacement for cross-spawn. Our implementation already avoids process.chdir() entirely, so we weren't hit by this bug, but I added E2E test to make sure that my package won't suffer this bug in the future. Really appreciate the fix! |
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.
On Windows,
process.chdir()is unavailable inside Worker threads. Whenspawnreceives an explicit relative command such as./fixtures/shebangand a customcwd,which.sync()resolves the command from the parent process working directory, so the spawn fails withENOENT.Resolve explicit relative paths against the requested child
cwdwhen cwd switching is unavailable. Bare command names continue to resolve throughPATH.Validation:
npm run lint— passed.npm test -- --runInBand --testNamePattern='^(?!.*should NOT spawn a shell for a \.exe)'— 77 passed, 2 skipped.npm test -- --runInBand— 77 passed, 2 failed. The same two.exefixture tests fail at baseline becausewin-ppid.jsrelies onwmic, which is unavailable in this environment.