From dabe5bbbd1a0e227c754531e6e0468a80607cba6 Mon Sep 17 00:00:00 2001 From: Heyward Fann Date: Mon, 22 Apr 2024 18:28:14 +0800 Subject: [PATCH] fix(extension): quote cmd on windows Closes #4987 https://github.com/nodejs/node/issues/7367 --- src/extension/installer.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/extension/installer.ts b/src/extension/installer.ts index ca8f6cbf93e..71404539a33 100644 --- a/src/extension/installer.ts +++ b/src/extension/installer.ts @@ -236,7 +236,8 @@ export class Installer extends EventEmitter implements IInstaller { return new Promise((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}"` : this.npm + const child = child_process.spawn(cmd, args, { cwd: folder, shell: process.platform === 'win32', env: Object.assign(process.env, { NODE_ENV: 'production' })