From 2f15b0b092462fac330c325447e73d2132205f84 Mon Sep 17 00:00:00 2001 From: rafaelfranca <47848+rafaelfranca@users.noreply.github.com> Date: Mon, 26 Jan 2026 16:46:08 +0000 Subject: [PATCH] Use configured shell from vscode.env.shell instead of process.env.SHELL (#3917) This will make sure the detection system will use the configured shell in VS Code, and works without having on the SHELL environment variable set. Extracted from #3894. --- vscode/src/ruby.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/vscode/src/ruby.ts b/vscode/src/ruby.ts index 940285825..d0a6d8371 100644 --- a/vscode/src/ruby.ts +++ b/vscode/src/ruby.ts @@ -65,7 +65,6 @@ export class Ruby implements RubyInterface { .getConfiguration("rubyLsp") .get("rubyVersionManager")!; - private readonly shell = process.env.SHELL?.replace(/(\s+)/g, "\\$1"); private _env: NodeJS.ProcessEnv = {}; private _error = false; private readonly context: vscode.ExtensionContext; @@ -402,12 +401,8 @@ export class Ruby implements RubyInterface { private async toolExists(tool: string) { try { - let command = this.shell ? `${this.shell} -i -c '` : ""; - command += `${tool} --version`; - - if (this.shell) { - command += "'"; - } + const shell = vscode.env.shell.replace(/(\s+)/g, "\\$1"); + const command = `${shell} -i -c '${tool} --version'`; this.outputChannel.info(`Checking if ${tool} is available on the path with command: ${command}`);