Skip to content

Commit a87ca71

Browse files
committed
fix: sub processes with spaces work
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 47f7d93 commit a87ca71

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/builders.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class BomBuilder {
113113
)
114114
}
115115

116-
private getNpmCommand (process: NodeJS.Process): string {
116+
private getNpmCommand (process: NodeJS.Process): string | 'npm' {
117117
// `npm_execpath` will be whichever cli script has called this application by npm.
118118
// This can be `npm`, `npx`, or `undefined` if called by `node` directly.
119119
const execPath = process.env.npm_execpath ?? ''
@@ -160,8 +160,7 @@ export class BomBuilder {
160160
this.console.info('INFO | gather dependency tree ...')
161161
this.console.debug('DEBUG | npm-ls: run %s with %j in %s', command, args, projectDir)
162162
const npmLsReturns = spawnSync(command, args, {
163-
// must use a shell for Windows systems in order to work
164-
shell: true,
163+
shell: command === 'npm',
165164
cwd: projectDir,
166165
env: process.env,
167166
encoding: 'buffer',

0 commit comments

Comments
 (0)