Skip to content

Commit

Permalink
fix(extension): quote cmd on windows (#4988)
Browse files Browse the repository at this point in the history
Closes #4987

on windows, command should be quoted if containing spaces. nodejs/node#7367
  • Loading branch information
fannheyward committed Apr 23, 2024
1 parent 77ae2d4 commit 2ec3166
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/extension/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ export class Installer extends EventEmitter implements IInstaller {
return new Promise<void>((resolve, reject) => {
let args = this.getInstallArguments(this.npm, this.url)
this.log(`Installing dependencies by: ${this.npm} ${args.join(' ')}.`)
const child = child_process.spawn(this.npm, args, {
const cmd = process.platform === 'win32' && this.npm.includes(' ') ? `"${this.npm}"` : this.npm
const child = child_process.spawn(cmd, args, {
cwd: folder,
shell: process.platform === 'win32',
env: Object.assign(process.env, { NODE_ENV: 'production' })
Expand Down

0 comments on commit 2ec3166

Please sign in to comment.