Skip to content

Commit

Permalink
use execFile instead of exec (#898)
Browse files Browse the repository at this point in the history
* use execFile instead of exec

* fix for windows
  • Loading branch information
joaomoreno authored Sep 13, 2023
1 parent 70b844e commit 2e474b4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,18 +381,18 @@ export async function versionBump(options: IVersionBumpOptions): Promise<void> {
}
}

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

if (options.commitMessage) {
command = `${command} -m "${options.commitMessage.replace(/"/g, '')}"`;
args.push('-m', options.commitMessage);
}

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

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

if (!process.env['VSCE_TESTS']) {
process.stdout.write(stdout);
Expand Down

0 comments on commit 2e474b4

Please sign in to comment.