You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(benchmark): spawn npm via shell on Windows (#973)
* fix(benchmark): spawn npm via shell on Windows
Node refuses to spawnSync .cmd/.bat files without shell: true since
Node 18.20 / 20.15. `npm run benchmark --npm` failed on Windows because
scripts/lib/bench-config.ts invoked execFileSync('npm', ...) directly.
Introduce NPM_CMD / NPM_SHELL constants derived from os.platform() and
apply them at all three npm install call sites.
Fixes#966
* fix(benchmark): simplify npm spawn + harden install specs (#973)
Addresses Greptile review feedback on PR #973:
- Drop redundant NPM_CMD constant. When shell: true on Windows, cmd.exe
resolves bare `npm` to `npm.cmd` automatically, so a single NPM_SHELL
boolean is sufficient and all three execFileSync calls can use 'npm'
directly.
- Add assertSafePkgName / assertSafePkgVersion guards and apply them to
every registry- or package.json-sourced string that gets interpolated
into an `npm install` spec. This closes the shell-injection surface
flagged in the PR description without waiting on a separate follow-up.
Impact: 3 functions changed, 7 affected
* fix(benchmark): validate version before logging (#973)
Addresses Greptile review nit on PR #973: the log line at the top of
the npm mode path emitted the raw version string before
assertSafePkgVersion fired. Move the validation up-front so no
unvalidated value is ever logged or interpolated. Same for the native
package log: validate before logging, not after.
Impact: 1 functions changed, 6 affected
0 commit comments