Skip to content

Commit 2e474b4

Browse files
authored
use execFile instead of exec (#898)
* use execFile instead of exec * fix for windows
1 parent 70b844e commit 2e474b4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/package.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,18 +381,18 @@ export async function versionBump(options: IVersionBumpOptions): Promise<void> {
381381
}
382382
}
383383

384-
let command = `npm version ${options.version}`; // CodeQL [SM03609] options.version is checked above.
384+
// call `npm version` to do our dirty work
385+
const args = ['version', options.version];
385386

386387
if (options.commitMessage) {
387-
command = `${command} -m "${options.commitMessage.replace(/"/g, '')}"`;
388+
args.push('-m', options.commitMessage);
388389
}
389390

390391
if (!(options.gitTagVersion ?? true)) {
391-
command = `${command} --no-git-tag-version`;
392+
args.push('--no-git-tag-version');
392393
}
393394

394-
// call `npm version` to do our dirty work
395-
const { stdout, stderr } = await promisify(cp.exec)(command, { cwd });
395+
const { stdout, stderr } = await promisify(cp.execFile)(process.platform === 'win32' ? 'npm.cmd' : 'npm', args, { cwd });
396396

397397
if (!process.env['VSCE_TESTS']) {
398398
process.stdout.write(stdout);

0 commit comments

Comments
 (0)