@@ -63,7 +63,10 @@ function getBashMaxLines(): number {
6363}
6464
6565// Helper function to use login shell on Unix/macOS and PowerShell on Windows and available shell in WSL
66- function getShellCommand ( command : string ) : { shell : string ; args : string [ ] } {
66+ export function getShellCommand ( command : string ) : {
67+ shell : string ;
68+ args : string [ ] ;
69+ } {
6770 if ( process . platform === "win32" ) {
6871 // Windows: Use PowerShell
6972 return {
@@ -77,13 +80,25 @@ function getShellCommand(command: string): { shell: string; args: string[] } {
7780 const wslShell = process . env . SHELL || "/bin/bash" ;
7881 return {
7982 shell : wslShell ,
80- args : [ "-l" , "-c" , command ] ,
83+ args : shellSupportsLoginFlag ( wslShell )
84+ ? [ "-l" , "-c" , command ]
85+ : [ "-c" , command ] ,
8186 } ;
8287 }
8388
8489 // Unix/macOS: Use login shell to source .bashrc/.zshrc etc.
8590 const userShell = process . env . SHELL || "/bin/bash" ;
86- return { shell : userShell , args : [ "-l" , "-c" , command ] } ;
91+ return {
92+ shell : userShell ,
93+ args : shellSupportsLoginFlag ( userShell )
94+ ? [ "-l" , "-c" , command ]
95+ : [ "-c" , command ] ,
96+ } ;
97+ }
98+
99+ function shellSupportsLoginFlag ( shell : string ) : boolean {
100+ const shellName = shell . split ( / [ \\ / ] / ) . pop ( ) ?. toLowerCase ( ) ;
101+ return shellName !== "csh" && shellName !== "tcsh" ;
87102}
88103
89104export function runCommandInBackground ( command : string ) : {
0 commit comments