Skip to content

Commit d0b3b35

Browse files
authored
Merge pull request #6 from DenisKolodin/win-escape-fix
Escape GET parameters in Windows
2 parents da45d9b + 3f4319c commit d0b3b35

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/lib.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ pub fn that<T:AsRef<OsStr>+Sized>(path: T) -> io::Result<ExitStatus> {
3939

4040
#[cfg(target_os = "windows")]
4141
pub fn that<T:AsRef<OsStr>+Sized>(path: T) -> io::Result<ExitStatus> {
42-
try!(Command::new("cmd").arg("/C").arg("start").arg(path.as_ref()).spawn()).wait()
42+
let mut cmd = Command::new("cmd");
43+
cmd.arg("/C").arg("start");
44+
if let Some(s) = path.as_ref().to_str() {
45+
cmd.arg(s.replace("&", "^&"));
46+
} else {
47+
cmd.arg(path.as_ref());
48+
}
49+
try!(cmd.spawn()).wait()
4350
}
4451

4552
#[cfg(target_os = "macos")]

0 commit comments

Comments
 (0)