mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
feat: inline terminal respects VSCode shell configuration
This commit is contained in:
parent
caa37792ca
commit
36b98bdcdb
2 changed files with 22 additions and 2 deletions
|
|
@ -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<RooTerminal>
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue