From 4b16cf337b106fa80833fe1f22ccac2bb0a4d37f Mon Sep 17 00:00:00 2001 From: Andrew Nolte Date: Tue, 28 May 2024 15:13:39 -0400 Subject: [PATCH] fix missing shell --- src/lib/libconfig.ts | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/lib/libconfig.ts b/src/lib/libconfig.ts index 8ee9b14..e52fe64 100644 --- a/src/lib/libconfig.ts +++ b/src/lib/libconfig.ts @@ -506,7 +506,7 @@ export class PathConfigObject extends ConfigObject { 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}`) return '' @@ -526,9 +526,7 @@ export class PathConfigObject extends ConfigObject { 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 } @@ -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' + } +}