27 FILE *pipe = popen(command,
"r");
32 while (fgets(buffer,
sizeof buffer, pipe) !=
nullptr) {
37 int exit_status = pclose(pipe);
38 if (exit_status != 0) {
40 "Command failed with exit status " + std::to_string(exit_status));
46 int exit_status = pclose(pipe);
47 if (exit_status != 0) {
49 "Command failed with exit status " + std::to_string(exit_status));
This header file contains utility functions related to exception handling in the code.
namespace for basic c++ utilities
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
std::string popen_fetch_output(const char *command)
Run a command and return the output.