MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / build_exec_targets_pipe_command

Function build_exec_targets_pipe_command

src/cli/exec/multi_targets.rs:74–97  ·  view source on GitHub ↗

Build a shell command string that pipes BenchmarkTarget::Exec variants to exec-harness via stdin

(
    targets: &[&crate::executor::config::BenchmarkTarget],
)

Source from the content-addressed store, hash-verified

72
73/// Build a shell command string that pipes BenchmarkTarget::Exec variants to exec-harness via stdin
74pub fn build_exec_targets_pipe_command(
75 targets: &[&crate::executor::config::BenchmarkTarget],
76) -> Result<String> {
77 let inputs: Vec<BenchmarkCommand> = targets
78 .iter()
79 .map(|target| match target {
80 crate::executor::config::BenchmarkTarget::Exec {
81 command,
82 name,
83 walltime_args,
84 } => Ok(BenchmarkCommand {
85 command: command.clone(),
86 name: name.clone(),
87 walltime_args: walltime_args.clone(),
88 }),
89 crate::executor::config::BenchmarkTarget::Entrypoint { .. } => {
90 bail!("Entrypoint targets cannot be used with exec-harness pipe command")
91 }
92 })
93 .collect::<Result<Vec<_>>>()?;
94
95 let json = serde_json::to_string(&inputs).context("Failed to serialize targets to JSON")?;
96 build_pipe_command_from_json(&json)
97}
98
99fn build_pipe_command_from_json(json: &str) -> Result<String> {
100 let exec_harness = InternalCommands::ExecHarness(ExecHarnessArgs {

Callers 1

executeMethod · 0.85

Calls 1

Tested by

no test coverage detected