windows: Fix the test_exists unit test

Turns out the `timeout` command was exiting immediately because it didn't like
its output piped. Instead use `ping` repeatedly to get a process that will sleep
for awhile.

cc #12516
This commit is contained in:
Alex Crichton 2014-02-24 10:59:11 -08:00
parent c0e767b00b
commit 13a8fcd3e9
1 changed files with 5 additions and 2 deletions

View File

@ -814,7 +814,10 @@ mod tests {
}
#[cfg(windows)]
pub fn sleeper() -> Process {
Process::new("timeout", [~"1000"]).unwrap()
// There's a `timeout` command on windows, but it doesn't like having
// its output piped, so instead just ping ourselves a few times with
// gaps inbetweeen so we're sure this process is alive for awhile
Process::new("ping", [~"127.0.0.1", ~"-n", ~"1000"]).unwrap()
}
iotest!(fn test_kill() {
@ -828,5 +831,5 @@ mod tests {
assert!(Process::kill(p.id(), 0).is_ok());
p.signal_kill().unwrap();
assert!(!p.wait().success());
} #[ignore(cfg(windows))]) // FIXME(#12516)
})
}