diff --git a/packages/hurl/src/cli/options.rs b/packages/hurl/src/cli/options.rs index 43af32bc3..0c0dae29f 100644 --- a/packages/hurl/src/cli/options.rs +++ b/packages/hurl/src/cli/options.rs @@ -28,6 +28,16 @@ use std::io::{BufRead, BufReader}; use std::path::{Path, PathBuf}; use std::time::Duration; +#[cfg(target_family = "unix")] +pub fn dev_null() -> String { + "/dev/null".to_string() +} + +#[cfg(target_family = "windows")] +pub fn dev_null() -> String { + "nul".to_string() +} + #[derive(Clone, Debug, PartialEq, Eq)] pub struct CliOptions { pub color: bool, @@ -323,7 +333,7 @@ pub fn parse_options(matches: ArgMatches) -> Result { let output = if let Some(filename) = matches.value_of("output") { Some(filename.to_string()) } else if matches.is_present("test") { - Some("/dev/null".to_string()) + Some(dev_null()) } else { None };