diff --git a/src/benchmarks/network.rs b/src/benchmarks/network.rs index 4a7e17d..7080dc8 100644 --- a/src/benchmarks/network.rs +++ b/src/benchmarks/network.rs @@ -7,10 +7,16 @@ use crate::text; pub fn ping_host(address: &str, count: &u16) { println!("Pinging host {}, {} times.", address, count); + let mut count_arg = "-c"; + if cfg!(windows) { + count_arg = "-n"; + } + // run the ping command let output = process::Command::new("ping") .arg(address) - .arg(format!("-c {}", count)) + .arg(count_arg) + .arg(format!("{}", count)) .output() .expect("Failed to execute command"); @@ -29,10 +35,16 @@ pub fn ping_host(address: &str, count: &u16) { pub fn jitter_test(address: &str, count: &u16) { println!("Pinging host {}, {} times to determine network jitter.", address, count); + let mut count_arg = "-c"; + if cfg!(windows) { + count_arg = "-n"; + } + // run the ping command let output = process::Command::new("ping") .arg(address) - .arg(format!("-c {}", count)) + .arg(count_arg) + .arg(format!("{}", count)) .output() .expect("Failed to execute command");