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

Method execute_script_from_path

src/executor/wall_time/executor.rs:41–56  ·  view source on GitHub ↗
(path: P)

Source from the content-addressed store, hash-verified

39
40impl HookScriptsGuard {
41 fn execute_script_from_path<P: AsRef<Path>>(path: P) -> anyhow::Result<()> {
42 let path = path.as_ref();
43 if !path.exists() || !path.is_file() {
44 debug!("Script not found or not a file: {}", path.display());
45 return Ok(());
46 }
47
48 let output = Command::new("bash").args([&path]).output()?;
49 if !output.status.success() {
50 debug!("stdout: {}", String::from_utf8_lossy(&output.stdout));
51 debug!("stderr: {}", String::from_utf8_lossy(&output.stderr));
52 bail!("Failed to execute script: {}", path.display());
53 }
54
55 Ok(())
56 }
57
58 pub fn setup_with_scripts<P: AsRef<Path>>(pre_bench_script: P, post_bench_script: P) -> Self {
59 if let Err(e) = Self::execute_script_from_path(pre_bench_script.as_ref()) {

Callers

nothing calls this directly

Calls 1

argsMethod · 0.80

Tested by

no test coverage detected