Skip to content

Commit 13a8fcd

Browse files
committed
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
1 parent c0e767b commit 13a8fcd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/libstd/io/process.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,10 @@ mod tests {
814814
}
815815
#[cfg(windows)]
816816
pub fn sleeper() -> Process {
817-
Process::new("timeout", [~"1000"]).unwrap()
817+
// There's a `timeout` command on windows, but it doesn't like having
818+
// its output piped, so instead just ping ourselves a few times with
819+
// gaps inbetweeen so we're sure this process is alive for awhile
820+
Process::new("ping", [~"127.0.0.1", ~"-n", ~"1000"]).unwrap()
818821
}
819822

820823
iotest!(fn test_kill() {
@@ -828,5 +831,5 @@ mod tests {
828831
assert!(Process::kill(p.id(), 0).is_ok());
829832
p.signal_kill().unwrap();
830833
assert!(!p.wait().success());
831-
} #[ignore(cfg(windows))]) // FIXME(#12516)
834+
})
832835
}

0 commit comments

Comments
 (0)