Conversation

bgotink

Scenario:

Windows machine with Path environment key containing the PATH. An environment is passed in where the PATH is named PATH.
cross-spawn will pass an undefined path into which, which makes which fall back to process.env.Path.

This is troublesome if the first hit in options.env.PATH is not an executable file but the first hit in process.env.Path is an executable file. cross-spawn doesn't realise it needs to wrap the command with cmd.exe.

We're running into this in yarnpkg/berry#1377, where we prepend the PATH with a folder containing node.cmd but cross-spawn detects C:\Program Files\nodejs\node.exe instead.

@codecov

Codecov Report

Merging #133 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #133   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          162       163    +1     
  Branches        34        35    +1     
=========================================
+ Hits           162       163    +1     
Impacted FilesCoverage Δ
lib/util/resolveCommand.js100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7501971...9a4cca3. Read the comment docs.

@satazorsatazor merged commit 159e7e9 into moxystudio:master May 24, 2020
@satazor

Thanks for your contribution, will release soon.

@satazor

Released: 7bc42bc

@bgotink

Wow that was fast! Thanks!

gurus00 pushed a commit to gurus00/node-cross-spawn that referenced this pull request Feb 11, 2025
Sign up for free to join this conversation on . Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.