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)
| 83 | /// directories are prepended to the current `PATH`. Otherwise the current |
| 84 | /// `PATH` is returned unchanged. |
| 85 | pub 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 | |
| 104 | pub fn is_codspeed_debug_enabled() -> bool { |
| 105 | std::env::var("CODSPEED_LOG") |
no test coverage detected