mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 17:00:18 +00:00
expose HYPERFINE_ITERATION to intermediate commands
Fixes: #781 Expose the `$HYPERFINE_ITERATION` variable to intermediate commands. This will allow iteration-specific prepare/conclude, such as: ```bash hyperfine --runs 5 --prepare 'echo touch file${HYPERFINE_ITERATION}.dat' \ 'echo testing file${HYPERFINE_ITERATION}.dat' \ --conclude 'echo rm file${HYPERFINE_ITERATION}.dat' --show-output ```
This commit is contained in:
1 parent
29a0ef164d
commit
44c0cc231b
3 files changed
+158
-26
No files matched your search
@@ -36,7 +36,7 @@ pub trait Executor {
|
||||
fn run_command_and_measure(
|
||||
&self,
|
||||
command: &Command<'_>,
|
||||
iteration: BenchmarkIteration,
|
||||
iteration: &BenchmarkIteration,
|
||||
command_failure_action: Option<CmdFailureAction>,
|
||||
output_policy: &CommandOutputPolicy,
|
||||
) -> Result<Measurement>;
|
||||
@@ -56,7 +56,7 @@ pub trait Executor {
|
||||
|
||||
fn run_command_and_measure_common(
|
||||
mut command: std::process::Command,
|
||||
iteration: BenchmarkIteration,
|
||||
iteration: &BenchmarkIteration,
|
||||
command_failure_action: CmdFailureAction,
|
||||
command_input_policy: &CommandInputPolicy,
|
||||
command_output_policy: &CommandOutputPolicy,
|
||||
@@ -132,7 +132,7 @@ impl Executor for RawExecutor<'_> {
|
||||
fn run_command_and_measure(
|
||||
&self,
|
||||
command: &Command<'_>,
|
||||
iteration: BenchmarkIteration,
|
||||
iteration: &BenchmarkIteration,
|
||||
command_failure_action: Option<CmdFailureAction>,
|
||||
output_policy: &CommandOutputPolicy,
|
||||
) -> Result<Measurement> {
|
||||
@@ -175,7 +175,7 @@ impl Executor for ShellExecutor<'_> {
|
||||
fn run_command_and_measure(
|
||||
&self,
|
||||
command: &Command<'_>,
|
||||
iteration: BenchmarkIteration,
|
||||
iteration: &BenchmarkIteration,
|
||||
command_failure_action: Option<CmdFailureAction>,
|
||||
output_policy: &CommandOutputPolicy,
|
||||
) -> Result<Measurement> {
|
||||
@@ -230,7 +230,7 @@ impl Executor for ShellExecutor<'_> {
|
||||
// Just run the shell without any command
|
||||
let res = self.run_command_and_measure(
|
||||
&Command::new(None, ""),
|
||||
BenchmarkIteration::NonBenchmarkRun,
|
||||
&BenchmarkIteration::NonBenchmarkRun,
|
||||
None,
|
||||
&CommandOutputPolicy::Null,
|
||||
);
|
||||
@@ -304,7 +304,7 @@ impl Executor for MockExecutor {
|
||||
fn run_command_and_measure(
|
||||
&self,
|
||||
command: &Command<'_>,
|
||||
_iteration: BenchmarkIteration,
|
||||
_iteration: &BenchmarkIteration,
|
||||
_command_failure_action: Option<CmdFailureAction>,
|
||||
_output_policy: &CommandOutputPolicy,
|
||||
) -> Result<Measurement> {
|
||||
|
||||
Reference in new issue
Block a user