Skip to content

Commit 5571942

Browse files
committed
Cleanup installLinks
1 parent a262b73 commit 5571942

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/shadow/npm/bin.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ export default async function shadowBin(
8080
stdio = ['pipe', 'pipe', 'pipe', 'ipc']
8181
}
8282

83+
const realBinPath = await installLinks(constants.shadowBinPath, binName)
84+
8385
const spawnPromise = spawn(
8486
constants.execPath,
8587
[
@@ -92,7 +94,7 @@ export default async function shadowBin(
9294
: []),
9395
'--require',
9496
constants.shadowNpmInjectPath,
95-
await installLinks(constants.shadowBinPath, binName),
97+
realBinPath,
9698
...(useNodeOptions
9799
? [
98100
`--node-options='${nodeOptionsArg ? nodeOptionsArg.slice(15) : ''}${cmdFlagsToString(permArgs)}'`,

src/shadow/npm/link.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from '../../utils/npm-paths.mts'
1212

1313
export async function installLinks(
14-
realBinPath: string,
14+
shadowBinPath: string,
1515
binName: 'npm' | 'npx',
1616
): Promise<string> {
1717
const isNpx = binName === 'npx'
@@ -28,11 +28,11 @@ export async function installLinks(
2828
if (WIN32) {
2929
await cmdShim(
3030
path.join(constants.distPath, `${binName}-cli.js`),
31-
path.join(realBinPath, binName),
31+
path.join(shadowBinPath, binName),
3232
)
3333
}
3434
const { env } = process
35-
env['PATH'] = `${realBinPath}${path.delimiter}${env['PATH']}`
35+
env['PATH'] = `${shadowBinPath}${path.delimiter}${env['PATH']}`
3636
}
3737
return binPath
3838
}

0 commit comments

Comments
 (0)