File: sleep.rs

package info (click to toggle)
rust-async-process 2.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 248 kB
  • sloc: makefile: 2; sh: 1
file content (26 lines) | stat: -rw-r--r-- 526 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//! Sleep test.

use async_process::Command;
use futures_lite::future::block_on;

#[cfg(unix)]
#[test]
fn unix_sleep() {
    block_on(async {
        let status = Command::new("sleep").arg("1").status().await.unwrap();
        assert!(status.success());
    });
}

#[cfg(windows)]
#[test]
fn windows_sleep() {
    block_on(async {
        let status = Command::new("ping")
            .args(["-n", "5", "127.0.0.1"])
            .status()
            .await
            .unwrap();
        assert!(status.success());
    });
}