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

Function build_path_env

src/executor/helpers/env.rs:85–102  ·  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

83/// directories are prepended to the current `PATH`. Otherwise the current
84/// `PATH` is returned unchanged.
85pub fn build_path_env(enable_introspection: bool) -> Result<String> {
86 let path_env = std::env::var("PATH").unwrap_or_default();
87 if !enable_introspection {
88 return Ok(path_env);
89 }
90
91 let node_path = introspected_nodejs::setup()
92 .map_err(|e| anyhow!("failed to setup NodeJS introspection. {e}"))?;
93 let go_path = introspected_golang::setup()
94 .map_err(|e| anyhow!("failed to setup Go introspection. {e}"))?;
95
96 Ok(format!(
97 "{}:{}:{}",
98 node_path.to_string_lossy(),
99 go_path.to_string_lossy(),
100 path_env,
101 ))
102}
103
104pub fn is_codspeed_debug_enabled() -> bool {
105 std::env::var("CODSPEED_LOG")

Callers 3

walltime_bench_cmdMethod · 0.85
measureFunction · 0.85

Calls 1

setupFunction · 0.50

Tested by

no test coverage detected