11import * as vscode from "vscode"
2+ import { TerminalProfile } from "../../utils/shell"
23
34export interface TerminalInfo {
45 terminal : vscode . Terminal
@@ -13,11 +14,24 @@ export class TerminalRegistry {
1314 private static terminals : TerminalInfo [ ] = [ ]
1415 private static nextTerminalId = 1
1516
17+ private static getShellConfigKey ( ) : string {
18+ if ( process . platform === "win32" ) {
19+ return "windows"
20+ } else if ( process . platform === "darwin" ) {
21+ return "osx"
22+ } else {
23+ return "linux"
24+ }
25+ }
26+
1627 static createTerminal ( cwd ?: string | vscode . Uri | undefined ) : TerminalInfo {
28+ const shellConfig = this . getAutomationShellConfig ( )
1729 const terminal = vscode . window . createTerminal ( {
1830 cwd,
1931 name : "Roo Code" ,
2032 iconPath : new vscode . ThemeIcon ( "rocket" ) ,
33+ shellPath : shellConfig ?. path ,
34+ shellArgs : shellConfig ?. args ,
2135 env : {
2236 PAGER : "cat" ,
2337 } ,
@@ -61,4 +75,22 @@ export class TerminalRegistry {
6175 private static isTerminalClosed ( terminal : vscode . Terminal ) : boolean {
6276 return terminal . exitStatus !== undefined
6377 }
78+
79+ // Get the shell path from the extension settings, or use the default shell path.
80+ private static getAutomationShell ( ) : string | undefined {
81+ const shellOverrides = vscode . workspace . getConfiguration ( "roo-cline.shell" ) || { }
82+ return shellOverrides . get < string > ( this . getShellConfigKey ( ) )
83+ }
84+
85+ // Get the shell path and args from the extension settings, or use the default shell path and args.
86+ private static getAutomationShellConfig ( ) : TerminalProfile | undefined {
87+ const shell = this . getAutomationShell ( )
88+ if ( shell === undefined ) {
89+ return undefined
90+ }
91+ const shellProfiles =
92+ vscode . workspace . getConfiguration ( `terminal.integrated.profiles.${ this . getShellConfigKey ( ) } ` ) || { }
93+ const selectedProfile = shellProfiles . get < TerminalProfile > ( shell )
94+ return selectedProfile
95+ }
6496}
0 commit comments