MCPcopy Create free account
hub / github.com/TheImagingSource/tiscamera / exec

Function exec

tools/tcam-ctrl/system.cpp:12–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10{
11
12std::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
39bool check_package(const std::string& pckg_name)

Callers 2

check_packageFunction · 0.85
check_system_infoFunction · 0.85

Calls 2

c_strMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected