Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyperfine no longer auto assumes /C for windows if cmd.exe is not the selected shell. #582

Merged
merged 1 commit into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/benchmark/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ impl<'a> Executor for ShellExecutor<'a> {
) -> Result<(TimingResult, ExitStatus)> {
let mut command_builder = self.shell.command();
command_builder
.arg(if cfg!(windows) { "/C" } else { "-c" })
.arg(
if cfg!(windows) && *self.shell == Shell::Default("cmd.exe") {
"/C"
} else {
"-c"
},
)
.arg(command.get_command_line());

let mut result = run_command_and_measure_common(
Expand Down
2 changes: 1 addition & 1 deletion src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub const DEFAULT_SHELL: &str = "sh";
pub const DEFAULT_SHELL: &str = "cmd.exe";

/// Shell to use for executing benchmarked commands
#[derive(Debug)]
#[derive(Debug, PartialEq)]
pub enum Shell {
/// Default shell command
Default(&'static str),
Expand Down