Skip to content

Commit

Permalink
If a wsl dist name is found then use that dist name when invoking the…
Browse files Browse the repository at this point in the history
… `wsl` command.
  • Loading branch information
carlolars authored and andy-5 committed Jul 14, 2022
1 parent 22ed6ec commit 779c7cd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,18 @@ fn main() {

let git_cmd: String = git_args.join(" ");

let curr_dir = env::current_dir().unwrap();
// Assumes that the first element in args is the executable
let args: Vec<String> = env::args().skip(1).collect();
let working_directory = get_working_directory(curr_dir, &args);
match get_wsl_dist_name(&working_directory) {
Some(wsl_dist) => {
cmd_args.push("--distribution".to_string());
cmd_args.push(wsl_dist.to_string());
}
None => {}
}

// build the command arguments that are passed to wsl.exe
cmd_args.push("-e".to_string());
cmd_args.push(BASH_EXECUTABLE.to_string());
Expand Down

0 comments on commit 779c7cd

Please sign in to comment.