mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-10-28 16:18:57 +00:00
bug: quoting failure on windows-platform (#296)
This commit is contained in:
1 parent
25331f89f9
commit
bece2eacf0
1 file changed
+11
-3
@@ -1,3 +1,4 @@
|
||||
use std::os::windows::process::CommandExt;
|
||||
use std::process::ExitStatus;
|
||||
|
||||
use crate::command::Command;
|
||||
@@ -133,16 +134,23 @@ impl<'a> Executor for ShellExecutor<'a> {
|
||||
command: &Command<'_>,
|
||||
command_failure_action: Option<CmdFailureAction>,
|
||||
) -> Result<(TimingResult, ExitStatus)> {
|
||||
let on_windows_cmd = cfg!(windows) && *self.shell == Shell::Default("cmd.exe");
|
||||
let mut command_builder = self.shell.command();
|
||||
command_builder
|
||||
.arg(
|
||||
if cfg!(windows) && *self.shell == Shell::Default("cmd.exe") {
|
||||
if on_windows_cmd {
|
||||
"/C"
|
||||
} else {
|
||||
"-c"
|
||||
},
|
||||
)
|
||||
.arg(command.get_command_line());
|
||||
);
|
||||
|
||||
// Windows needs special treatment for its behavior on parsing cmd arguments
|
||||
if on_windows_cmd {
|
||||
command_builder.raw_arg(command.get_command_line());
|
||||
} else {
|
||||
command_builder.arg(command.get_command_line());
|
||||
}
|
||||
|
||||
let mut result = run_command_and_measure_common(
|
||||
command_builder,
|
||||
|
||||
Reference in new issue
Block a user