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