diff --git a/.git2gus/config.json b/.git2gus/config.json index f8c11636..e6cf85cd 100644 --- a/.git2gus/config.json +++ b/.git2gus/config.json @@ -2,6 +2,6 @@ "productTag": "a1aB0000000ce2IIAQ", "defaultBuild": "offcore.tooling.59", "issueTypeLabels": {"enhancement": "USER STORY", "bug": "BUG P3"}, - "hideWorkItemUrl": true, + "hideWorkItemUrl": "true", "statusWhenClosed": "CLOSED" } diff --git a/src/commands/version.ts b/src/commands/version.ts index 8ff350d0..f751eea7 100644 --- a/src/commands/version.ts +++ b/src/commands/version.ts @@ -1,6 +1,6 @@ import {Command, Flags, Interfaces} from '@oclif/core' import {Ansis} from 'ansis' -import {exec} from 'node:child_process' +import {execFile} from 'node:child_process' import {EOL} from 'node:os' const ansis = new Ansis() @@ -20,11 +20,17 @@ type NpmDetails = { async function getNpmDetails(pkg: string): Promise { return new Promise((resolve) => { - exec(`npm view ${pkg} --json`, (error, stdout) => { + // Use execFile instead of exec to avoid shell interpretation. + // exec invokes cmd.exe on Windows, which resolves commands from CWD before PATH. + execFile('npm', ['view', pkg, '--json'], (error, stdout) => { if (error) { resolve(false) } else { - resolve(JSON.parse(stdout) as NpmDetails) + try { + resolve(JSON.parse(stdout) as NpmDetails) + } catch { + resolve(false) + } } }) })