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

Function build_path_env

src/executor/helpers/env.rs:49–66  ·  view source on GitHub ↗

Build the `PATH` value with optional language introspection wrappers prepended. When `enable_introspection` is true, the Node.js and Go wrapper script directories are prepended to the current `PATH`. Otherwise the current `PATH` is returned unchanged.

(enable_introspection: bool)

Source from the content-addressed store, hash-verified

47/// directories are prepended to the current `PATH`. Otherwise the current
48/// `PATH` is returned unchanged.
49pub fn build_path_env(enable_introspection: bool) -> Result<String> {
50 let path_env = std::env::var("PATH").unwrap_or_default();
51 if !enable_introspection {
52 return Ok(path_env);
53 }
54
55 let node_path = introspected_nodejs::setup()
56 .map_err(|e| anyhow!("failed to setup NodeJS introspection. {e}"))?;
57 let go_path = introspected_golang::setup()
58 .map_err(|e| anyhow!("failed to setup Go introspection. {e}"))?;
59
60 Ok(format!(
61 "{}:{}:{}",
62 node_path.to_string_lossy(),
63 go_path.to_string_lossy(),
64 path_env,
65 ))
66}
67
68pub fn is_codspeed_debug_enabled() -> bool {
69 std::env::var("CODSPEED_LOG")

Callers 4

walltime_bench_cmdMethod · 0.85
bench_cmdMethod · 0.85
measureFunction · 0.85

Calls 1

setupFunction · 0.50

Tested by

no test coverage detected