| 10 | { |
| 11 | |
| 12 | std::string exec(const std::string& cmd) |
| 13 | { |
| 14 | |
| 15 | std::array<char, 128> buffer; |
| 16 | std::string result; |
| 17 | |
| 18 | // std::cout << "Opening reading pipe" << std::endl; |
| 19 | FILE* pipe = popen(cmd.c_str(), "r"); |
| 20 | if (!pipe) |
| 21 | { |
| 22 | std::cerr << "Couldn't start command." << std::endl; |
| 23 | return ""; |
| 24 | } |
| 25 | while (fgets(buffer.data(), 128, pipe) != NULL) |
| 26 | { |
| 27 | // std::cout << "Reading..." << std::endl; |
| 28 | result += buffer.data(); |
| 29 | } |
| 30 | /*auto returnCode =*/pclose(pipe); |
| 31 | |
| 32 | // std::cout << result << std::endl; |
| 33 | // std::cout << returnCode << std::endl; |
| 34 | |
| 35 | return result; |
| 36 | } |
| 37 | |
| 38 | |
| 39 | bool check_package(const std::string& pckg_name) |
no test coverage detected