Skip to content

Commit 1801e0a

Browse files
author
Zoo Code Contributor
committed
fix(terminal): use detected shell for execa and vscode terminal creation (Zoo-Code-Org#321)
Connect the existing getShell() to both terminal creation paths to fix the Windows shell mismatch where AI generates pwsh syntax but commands execute in cmd.exe. - ExecaTerminalProcess: use getShell() instead of shell: true - Terminal: pass shellPath: getShell() to createTerminal Fixes Zoo-Code-Org#321
1 parent 9d022d4 commit 1801e0a

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎src/integrations/terminal/ExecaTerminalProcess.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import process from "process"
55
import type { RooTerminal } from "./types"
66
import { BaseTerminal } from "./BaseTerminal"
77
import { BaseTerminalProcess } from "./BaseTerminalProcess"
8+
import { getShell } from "../../utils/shell"
89

910
export class ExecaTerminalProcess extends BaseTerminalProcess {
1011
private terminalRef: WeakRef<RooTerminal>
@@ -40,7 +41,7 @@ export class ExecaTerminalProcess extends BaseTerminalProcess {
4041
this.isHot = true
4142

4243
this.subprocess = execa({
43-
shell: BaseTerminal.getExecaShellPath() || true,
44+
shell: BaseTerminal.getExecaShellPath() || getShell(),
4445
cwd: this.terminal.getCurrentWorkingDirectory(),
4546
all: true,
4647
// Ignore stdin to ensure non-interactive mode and prevent hanging
@@ -111,7 +112,7 @@ export class ExecaTerminalProcess extends BaseTerminalProcess {
111112
timeoutId = setTimeout(() => {
112113
try {
113114
this.subprocess?.kill("SIGKILL")
114-
} catch (e) {}
115+
} catch (e) { }
115116

116117
resolve()
117118
}, 5_000)

‎src/integrations/terminal/Terminal.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { BaseTerminal } from "./BaseTerminal"
66
import { TerminalProcess } from "./TerminalProcess"
77
import { ShellIntegrationManager } from "./ShellIntegrationManager"
88
import { mergePromise } from "./mergePromise"
9+
import { getShell } from "../../utils/shell"
910

1011
export class Terminal extends BaseTerminal {
1112
public terminal: vscode.Terminal
@@ -17,7 +18,7 @@ export class Terminal extends BaseTerminal {
1718

1819
const env = Terminal.getEnv()
1920
const iconPath = new vscode.ThemeIcon("rocket")
20-
this.terminal = terminal ?? vscode.window.createTerminal({ cwd, name: "Roo Code", iconPath, env })
21+
this.terminal = terminal ?? vscode.window.createTerminal({ cwd, name: "Roo Code", iconPath, env, shellPath: getShell() })
2122

2223
if (Terminal.getTerminalZdotdir()) {
2324
ShellIntegrationManager.terminalTmpDirs.set(id, env.ZDOTDIR)

0 commit comments

Comments
 (0)