mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 17:00:18 +00:00
raise error if preparation_command length is not equal to command or 1
Signed-off-by: Saurav Sharma <appdroiddeveloper@gmail.com>
This commit is contained in:
1 parent
0c0713da30
commit
bc82bd5f23
2 files changed
+12
-5
No files matched your search
+10
@@ -33,6 +33,16 @@ fn run(commands: &[Command<'_>], options: &HyperfineOptions) -> io::Result<Vec<B
|
||||
|
||||
let mut timing_results = vec![];
|
||||
|
||||
// Check if preparation command is equal to command length or should be mentioned only once
|
||||
if let Some(preparation_command) = &options.preparation_command {
|
||||
if commands.len() != preparation_command.len() && preparation_command.len() > 1 {
|
||||
error(
|
||||
"--prepare option should be provided only 1 time or N times equal to number of \
|
||||
commands to benchmark",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Run the benchmarks
|
||||
for (num, cmd) in commands.iter().enumerate() {
|
||||
timing_results.push(run_benchmark(num, cmd, shell_spawning_time, options)?);
|
||||
|
||||
Reference in new issue
Block a user