Skip to content

Commit 80e0916

Browse files
committed
Fix shadow bin argument passing - args were shifted incorrectly
The shadow-bin/npm and shadow-bin/npx files were incorrectly passing the bin name ('npm'/'npx') as the first argument, which caused args to be set to a string instead of an array. This resulted in 'findLast is not a function' errors because strings don't have the findLast method. - shadow-bin/npm: Remove 'npm' argument (already hardcoded in shadowNpmBin) - shadow-bin/npx: Use correct shadowNpxBin function and remove 'npx' argument Fixes #911
1 parent 93808b4 commit 80e0916

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

shadow-bin/npm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void (async () => {
1111

1212
process.exitCode = 1
1313

14-
const { spawnPromise } = await shadowNpmBin('npm', process.argv.slice(2), { stdio: 'inherit' })
14+
const { spawnPromise } = await shadowNpmBin(process.argv.slice(2), { stdio: 'inherit' })
1515

1616
// See https://nodejs.org/api/child_process.html#event-exit.
1717
spawnPromise.process.on('exit', (code, signalName) => {

shadow-bin/npx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ void (async () => {
77
const rootPath = path.join(__dirname, '..')
88
Module.enableCompileCache?.(path.join(rootPath, '.cache'))
99

10-
const shadowNpmBin = require(path.join(rootPath, 'dist/shadow-npm-bin.js'))
10+
const shadowNpxBin = require(path.join(rootPath, 'dist/shadow-npx-bin.js'))
1111

1212
process.exitCode = 1
1313

14-
const { spawnPromise } = await shadowNpmBin('npx', process.argv.slice(2), { stdio: 'inherit' })
14+
const { spawnPromise } = await shadowNpxBin(process.argv.slice(2), { stdio: 'inherit' })
1515

1616
// See https://nodejs.org/api/child_process.html#event-exit.
1717
spawnPromise.process.on('exit', (code, signalName) => {

0 commit comments

Comments
 (0)