Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .git2gus/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"productTag": "a1aB0000000ce2IIAQ",
"defaultBuild": "offcore.tooling.59",
"issueTypeLabels": {"enhancement": "USER STORY", "bug": "BUG P3"},
"hideWorkItemUrl": true,
"hideWorkItemUrl": "true",
"statusWhenClosed": "CLOSED"
}
12 changes: 9 additions & 3 deletions src/commands/version.ts
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -20,11 +20,17 @@ type NpmDetails = {

async function getNpmDetails(pkg: string): Promise<false | NpmDetails> {
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)
}
}
})
})
Expand Down
Loading