@@ -15,6 +15,8 @@ mod wsl;
1515
1616const VERSION : & ' static str = env ! ( "CARGO_PKG_VERSION" ) ;
1717
18+ const BASH_EXECUTABLE : & str = "/bin/bash" ;
19+
1820static mut DOUBLE_DASH_FOUND : bool = false ;
1921
2022fn translate_path_to_unix ( argument : String ) -> String {
@@ -139,7 +141,7 @@ fn translate_path_to_win(line: &[u8]) -> Vec<u8> {
139141 let echo_cmd = format ! ( "echo -n \" {}\" " , line) ;
140142 let output = Command :: new ( "wsl" )
141143 . arg ( "-e" )
142- . arg ( "bash" )
144+ . arg ( BASH_EXECUTABLE )
143145 . arg ( "-c" )
144146 . arg ( & echo_cmd)
145147 . output ( )
@@ -279,7 +281,7 @@ fn main() {
279281
280282 // build the command arguments that are passed to wsl.exe
281283 cmd_args. push ( "-e" . to_string ( ) ) ;
282- cmd_args. push ( "/usr/bin/bash" . to_string ( ) ) ;
284+ cmd_args. push ( BASH_EXECUTABLE . to_string ( ) ) ;
283285 if use_interactive_shell ( ) {
284286 cmd_args. push ( "-ic" . to_string ( ) ) ;
285287 } else {
@@ -535,7 +537,7 @@ mod tests {
535537 fn unix_to_win_path_trans ( ) {
536538 let check_wslpath = Command :: new ( "wsl" )
537539 . arg ( "-e" )
538- . arg ( "bash" )
540+ . arg ( BASH_EXECUTABLE )
539541 . arg ( "-c" )
540542 . arg ( "wslpath C:\\ " )
541543 . output ( ) ;
@@ -556,7 +558,7 @@ mod tests {
556558 // (see https://github.com/microsoft/WSL/issues/4908)
557559 Command :: new ( "wsl" )
558560 . arg ( "-e" )
559- . arg ( "bash" )
561+ . arg ( BASH_EXECUTABLE )
560562 . arg ( "-c" )
561563 . arg ( "touch '/tmp/wslgit test file'" )
562564 . output ( )
@@ -578,7 +580,7 @@ mod tests {
578580 ) ;
579581 Command :: new ( "wsl" )
580582 . arg ( "-e" )
581- . arg ( "bash" )
583+ . arg ( BASH_EXECUTABLE )
582584 . arg ( "-c" )
583585 . arg ( "rm '/tmp/wslgit test file'" )
584586 . output ( )
0 commit comments