mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-02 09:01:25 +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 std::process::ExitStatus;
|
||||||
|
|
||||||
use crate::command::Command;
|
use crate::command::Command;
|
||||||
@@ -133,16 +134,23 @@ impl<'a> Executor for ShellExecutor<'a> {
|
|||||||
command: &Command<'_>,
|
command: &Command<'_>,
|
||||||
command_failure_action: Option<CmdFailureAction>,
|
command_failure_action: Option<CmdFailureAction>,
|
||||||
) -> Result<(TimingResult, ExitStatus)> {
|
) -> Result<(TimingResult, ExitStatus)> {
|
||||||
|
let on_windows_cmd = cfg!(windows) && *self.shell == Shell::Default("cmd.exe");
|
||||||
let mut command_builder = self.shell.command();
|
let mut command_builder = self.shell.command();
|
||||||
command_builder
|
command_builder
|
||||||
.arg(
|
.arg(
|
||||||
if cfg!(windows) && *self.shell == Shell::Default("cmd.exe") {
|
if on_windows_cmd {
|
||||||
"/C"
|
"/C"
|
||||||
} else {
|
} else {
|
||||||
"-c"
|
"-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(
|
let mut result = run_command_and_measure_common(
|
||||||
command_builder,
|
command_builder,
|
||||||
|
|||||||
Reference in new issue
Block a user