Skip to content

Commit 3f4319c

Browse files
committed
Escape GET parameters for Windows
1 parent da45d9b commit 3f4319c

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)