Skip to content

Commit

Permalink
handle ampersand correctly in WSL env
Browse files Browse the repository at this point in the history
  • Loading branch information
amodm committed Aug 16, 2023
1 parent 322bc61 commit 3da3e74
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,22 @@ fn try_wsl(options: &BrowserOptions, target: &TargetType) -> Result<()> {
match target.0.scheme() {
"http" | "https" => {
let url: &str = target;
try_browser!(options, "cmd.exe", "/c", "start", url)
.or_else(|_| try_browser!(options, "powershell.exe", "Start", url))
.or_else(|_| try_browser!(options, "wsl-open", url))
try_browser!(
options,
"cmd.exe",
"/c",
"start",
url.replace("^", "^^").replace("&", "^&")
)
.or_else(|_| {
try_browser!(
options,
"powershell.exe",
"Start",
url.replace("&", "\"&\"")
)
})
.or_else(|_| try_browser!(options, "wsl-open", url))
}
#[cfg(all(
target_os = "linux",
Expand Down

0 comments on commit 3da3e74

Please sign in to comment.