Skip to content

Commit

Permalink
Disable ping options on Windows. Refs #440
Browse files Browse the repository at this point in the history
  • Loading branch information
orf committed Dec 16, 2024
1 parent eee18b0 commit 613bf1c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gping/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ following color names: 'black', 'red', 'green', 'yellow', 'blue', 'magenta',
#[arg(name = "clear", long = "clear", action)]
clear: bool,

#[cfg(not(target_os = "windows"))]
/// Extra arguments to pass to `ping`. These are platform dependent.
#[arg(long, allow_hyphen_values = true, num_args = 0.., conflicts_with="cmd")]
ping_args: Option<Vec<String>>,
Expand Down Expand Up @@ -397,6 +398,11 @@ fn main() -> Result<()> {
#[cfg(target_os = "windows")]
let interface: Option<String> = None;

#[cfg(not(target_os = "windows"))]
let ping_args: Option<Vec<String>> = args.ping_args.clone();
#[cfg(target_os = "windows")]
let ping_args: Option<Vec<String>> = None;

let (key_tx, rx) = mpsc::channel();

let mut threads = vec![];
Expand Down Expand Up @@ -424,7 +430,7 @@ fn main() -> Result<()> {
} else {
PingOptions::new(host_or_cmd, interval, interface.clone())
};
if let Some(ping_args) = &args.ping_args {
if let Some(ping_args) = &ping_args {
ping_opts = ping_opts.with_raw_arguments(ping_args.clone());
}

Expand Down

0 comments on commit 613bf1c

Please sign in to comment.