Ubuntu doens't have a CPU governor.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "TemporaryFile.hpp"
|
||||
#include "json_variant.hpp"
|
||||
#include "GithubResponseHeaders.hpp"
|
||||
#include "Finally.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace pipedal;
|
||||
@@ -37,12 +38,15 @@ std::string psystem(const std::string &command)
|
||||
std::string cmdRedirected = command + " 2>&1";
|
||||
std::array<char, 128> buffer;
|
||||
std::string result;
|
||||
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmdRedirected.c_str(), "r"), pclose);
|
||||
FILE *pipe = popen(cmdRedirected.c_str(), "r");
|
||||
if (!pipe)
|
||||
{
|
||||
throw std::runtime_error("popen() failed!");
|
||||
}
|
||||
while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr)
|
||||
Finally ([pipe]() {
|
||||
pclose(pipe);
|
||||
});
|
||||
while (fgets(buffer.data(), buffer.size(), pipe) != nullptr)
|
||||
{
|
||||
result += buffer.data();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user