Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
Use wsl.exe to workaround double run of .bashrc
Browse files Browse the repository at this point in the history
- workaround for microsoft/WSL#2897
  • Loading branch information
diablodale committed Feb 2, 2018
1 parent 2ab9c81 commit 8fff651
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ fn translate_path_to_win(line: &str) -> String {
String::from(line)
}

/*
fn shell_escape(arg: String) -> String {
// ToDo: This really only handles arguments with spaces.
// More complete shell escaping is required for the general case.
Expand All @@ -59,12 +60,13 @@ fn shell_escape(arg: String) -> String {
}
arg
}
*/

fn main() {
let mut git_args: Vec<String> = vec![String::from("git")];
git_args.extend(env::args().skip(1)
.map(translate_path_to_unix)
.map(shell_escape));
//.map(shell_escape)
.map(translate_path_to_unix));
let git_cmd = git_args.join(" ");
let stdin_mode = if git_cmd.ends_with("--version") {
// For some reason, the git subprocess seems to hang, waiting for
Expand All @@ -79,10 +81,9 @@ fn main() {
} else {
Stdio::inherit()
};
let git_proc = Command::new("bash")
let git_proc = Command::new("wsl")
.env("BASH_ENV", "~/.bashrc")
.arg("-c")
.arg(&git_cmd)
.args(&git_args)
.stdin(stdin_mode)
.stdout(Stdio::piped())
.spawn()
Expand Down

0 comments on commit 8fff651

Please sign in to comment.