Skip to content

Commit

Permalink
fix missing shell
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewNolte committed May 28, 2024
1 parent dfe3511 commit 4b16cf3
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/lib/libconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ export class PathConfigObject extends ConfigObject<string> {
args = ['/c', `where ${path}`]
}
try {
const { stdout, stderr } = await execFilePromise(vscode.env.shell, args)
const { stdout, stderr } = await execFilePromise(getShell(), args)
if (stderr) {
console.error(`Error: ${stderr}`)

Check warning on line 511 in src/lib/libconfig.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest)

'console' is not defined

Check warning on line 511 in src/lib/libconfig.ts

View workflow job for this annotation

GitHub Actions / test (macos-latest)

'console' is not defined

Check warning on line 511 in src/lib/libconfig.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

'console' is not defined

Check warning on line 511 in src/lib/libconfig.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest)

'console' is not defined

Check warning on line 511 in src/lib/libconfig.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest)

'console' is not defined
return ''
Expand All @@ -526,9 +526,7 @@ export class PathConfigObject extends ConfigObject<string> {
let path = await this.getValueAsync()
if ((await this.which(path)) === '') {
vscode.window.showErrorMessage(
`"${this.getValue()}" not found. Configure abs path at ${
this.configPath
}, add to PATH, or disable in config.`
`"${path}" not found. Configure abs path at ${this.configPath}, add to PATH, or disable in config.`
)
return false
}
Expand Down Expand Up @@ -557,3 +555,19 @@ export function getPlatform(): Platform {
return 'linux'
}
}

export function getShell(): string {
if (vscode.env.shell !== '') {
return vscode.env.shell
}

if (process.env.SHELL !== undefined) {
return process.env.SHELL
}

if (getPlatform() === 'windows') {
return 'cmd.exe'
} else {
return '/bin/bash'
}
}

0 comments on commit 4b16cf3

Please sign in to comment.