diff --git a/cli/nodeutil.ts b/cli/nodeutil.ts index b3646db69d48..4cc79eba8f9c 100644 --- a/cli/nodeutil.ts +++ b/cli/nodeutil.ts @@ -284,7 +284,7 @@ export async function npmVersionBumpAsync( ): Promise { const output = await spawnWithPipeAsync({ cmd: addCmd("npm"), - args: ["version", bumpType, "--message", `"[pxt-cli] bump version to %s"`, "--git-tag-version", tagCommit ? "true" : "false"], + args: ["version", bumpType, "--message", quoteIfNeeded(`[pxt-cli] bump version to %s`), "--git-tag-version", tagCommit ? "true" : "false"], cwd: ".", silent: true, }); @@ -299,7 +299,7 @@ export async function npmVersionBumpAsync( }); await spawnAsync({ cmd: "git", - args: ["commit", "-m", `"[pxt-cli] bump version to ${ver}"`], + args: ["commit", "-m", quoteIfNeeded(`[pxt-cli] bump version to ${ver}`)], cwd: ".", silent: true, }); @@ -307,6 +307,13 @@ export async function npmVersionBumpAsync( return ver; } +function quoteIfNeeded(arg: string) { + if (os.platform() === "win32") { + return `"${arg}"`; + } + return arg; +} + export function gitPushAsync(followTags: boolean = true) { const args = ["push"]; if (followTags) args.push("--follow-tags");