9 #ifndef FAIR_MQ_TOOLS_PROCESS_H 10 #define FAIR_MQ_TOOLS_PROCESS_H 12 #include <boost/process.hpp> 28 std::string console_out;
40 inline execute_result execute(std::string cmd, std::string prefix =
"")
43 std::stringstream out;
46 std::stringstream printCmd;
47 printCmd << prefix << cmd <<
"\n";
48 std::cout << printCmd.str() << std::flush;
50 out << prefix << cmd << std::endl;
53 boost::process::ipstream stdout;
54 boost::process::child c(cmd, boost::process::std_out > stdout);
56 while (getline(stdout, line))
59 std::stringstream printLine;
60 printLine << prefix << line <<
"\n";
61 std::cout << printLine.str() << std::flush;
63 out << prefix << line <<
"\n";
69 result.exit_code = c.exit_code();
70 out << prefix <<
" Exit code: " << result.exit_code << std::endl;
72 result.console_out = out.str();
Definition: DeviceRunner.h:23