1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#ifndef CommonToolsUtils_popenCPP_H
#define CommonToolsUtils_popenCPP_H
#include <memory>
#include <string>
#include <sstream>
namespace reco {
namespace exprEvalDetails {
std::unique_ptr<std::istream> popenCPP(const std::string &cmdline);
inline std::string execSysCommand(const std::string &cmdline) {
std::ostringstream n1;
{
auto s1 = popenCPP(cmdline + " 2>&1");
n1 << s1->rdbuf();
}
return n1.str();
}
} // namespace exprEvalDetails
} // namespace reco
#endif // CommonToolsUtils__popenCPP_H
|