From 36b98bdcdb0f5dae421385fd38cab8c05f57cfb1 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Fri, 9 Jan 2026 01:07:00 +0000 Subject: [PATCH] feat: inline terminal respects VSCode shell configuration --- .../terminal/ExecaTerminalProcess.ts | 3 ++- .../__tests__/ExecaTerminalProcess.spec.ts | 21 ++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/integrations/terminal/ExecaTerminalProcess.ts b/src/integrations/terminal/ExecaTerminalProcess.ts index 370bf0d377b..bbbcab55e37 100644 --- a/src/integrations/terminal/ExecaTerminalProcess.ts +++ b/src/integrations/terminal/ExecaTerminalProcess.ts @@ -4,6 +4,7 @@ import process from "process" import type { RooTerminal } from "./types" import { BaseTerminalProcess } from "./BaseTerminalProcess" +import { getShell } from "../../utils/shell" export class ExecaTerminalProcess extends BaseTerminalProcess { private terminalRef: WeakRef @@ -39,7 +40,7 @@ export class ExecaTerminalProcess extends BaseTerminalProcess { this.isHot = true this.subprocess = execa({ - shell: true, + shell: getShell(), cwd: this.terminal.getCurrentWorkingDirectory(), all: true, // Ignore stdin to ensure non-interactive mode and prevent hanging diff --git a/src/integrations/terminal/__tests__/ExecaTerminalProcess.spec.ts b/src/integrations/terminal/__tests__/ExecaTerminalProcess.spec.ts index 873b8f85ab2..0d8473e2d99 100644 --- a/src/integrations/terminal/__tests__/ExecaTerminalProcess.spec.ts +++ b/src/integrations/terminal/__tests__/ExecaTerminalProcess.spec.ts @@ -1,6 +1,7 @@ // npx vitest run integrations/terminal/__tests__/ExecaTerminalProcess.spec.ts const mockPid = 12345 +const mockShell = "/bin/bash" vitest.mock("execa", () => { const mockKill = vitest.fn() @@ -21,8 +22,13 @@ vitest.mock("ps-tree", () => ({ default: vitest.fn((_: number, cb: any) => cb(null, [])), })) +vitest.mock("../../../utils/shell", () => ({ + getShell: vitest.fn(() => mockShell), +})) + import { execa } from "execa" import { ExecaTerminalProcess } from "../ExecaTerminalProcess" +import { getShell } from "../../../utils/shell" import type { RooTerminal } from "../types" describe("ExecaTerminalProcess", () => { @@ -55,13 +61,26 @@ describe("ExecaTerminalProcess", () => { vitest.clearAllMocks() }) + describe("shell configuration", () => { + it("should use shell from getShell() utility", async () => { + await terminalProcess.run("echo test") + const execaMock = vitest.mocked(execa) + expect(getShell).toHaveBeenCalled() + expect(execaMock).toHaveBeenCalledWith( + expect.objectContaining({ + shell: mockShell, + }), + ) + }) + }) + describe("UTF-8 encoding fix", () => { it("should set LANG and LC_ALL to en_US.UTF-8", async () => { await terminalProcess.run("echo test") const execaMock = vitest.mocked(execa) expect(execaMock).toHaveBeenCalledWith( expect.objectContaining({ - shell: true, + shell: mockShell, cwd: "/test/cwd", all: true, env: expect.objectContaining({