| 183 | |
| 184 | #ifdef __linux__ |
| 185 | bool command_exists(std::string const &cmd) |
| 186 | { |
| 187 | // command -v is part of POSIX so should be available |
| 188 | std::string check_command = "command -v " + cmd + " > /dev/null 2>&1"; |
| 189 | int r = std::system(check_command.c_str()); |
| 190 | // return value of std::system is implementation defined and can be |
| 191 | // decoded using WEXITSTATUS but it should be 0 on success |
| 192 | return r == 0; |
| 193 | } |
| 194 | #endif |
| 195 | } |
| 196 | #endif |
no outgoing calls
no test coverage detected