From ff798ad6156e51bd81b4c352f563ce0b463f143f Mon Sep 17 00:00:00 2001 From: Steve Pentland Date: Wed, 31 Jan 2018 19:23:24 -0500 Subject: [PATCH] Exclude entire cputime file, force basic output --- src/hyperfine/benchmark.rs | 8 ++++---- src/hyperfine/cputime.rs | 2 ++ src/main.rs | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/hyperfine/benchmark.rs b/src/hyperfine/benchmark.rs index 5c4868a..e419b35 100644 --- a/src/hyperfine/benchmark.rs +++ b/src/hyperfine/benchmark.rs @@ -100,8 +100,8 @@ pub fn time_shell_command( ) -> io::Result<(TimingResult, bool)> { let start = Instant::now(); - let status = Command::new("sh") - .arg("-c") + let status = Command::new("cmd") + // .arg("-c") .arg(shell_cmd) .stdin(Stdio::null()) .stdout(Stdio::null()) @@ -129,8 +129,8 @@ pub fn time_shell_command( Ok(( TimingResult { time_real, - time_user: 0, - time_system: 0, + time_user: 0f64, + time_system: 0f64, }, status.success(), )) diff --git a/src/hyperfine/cputime.rs b/src/hyperfine/cputime.rs index 19caa8c..41aa850 100644 --- a/src/hyperfine/cputime.rs +++ b/src/hyperfine/cputime.rs @@ -1,3 +1,5 @@ +#![cfg(not(target_os = "windows"))] + use libc::{getrusage, rusage, RUSAGE_CHILDREN}; use std::mem; diff --git a/src/main.rs b/src/main.rs index 4a1e55e..dbe9750 100644 --- a/src/main.rs +++ b/src/main.rs @@ -147,6 +147,10 @@ fn main() { }, }; + if cfg!(target_os = "windows") { + options.output_style = OutputStyleOption::Basic; + } + if options.output_style == OutputStyleOption::Basic { colored::control::set_override(false); }