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

Function command_has_executable

src/executor/helpers/detect_executable.rs:20–22  ·  view source on GitHub ↗

Check if a command string contains any of the given executable names. Splits the command into tokens on whitespace and shell operators, then checks for exact matches on the file name component. This is strictly better than `command.contains("java")` which would false-positive on "javascript".

(command: &str, names: &[&str])

Source from the content-addressed store, hash-verified

18/// for exact matches on the file name component. This is strictly better than
19/// `command.contains("java")` which would false-positive on "javascript".
20pub fn command_has_executable(command: &str, names: &[&str]) -> bool {
21 tokenize(command).any(|token| names.contains(&token))
22}
23
24#[cfg(test)]
25mod tests {

Callers 1

wrap_commandMethod · 0.85

Calls 1

tokenizeFunction · 0.85

Tested by

no test coverage detected