CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
popenCPP.h
Go to the documentation of this file.
1 #ifndef CommonToolsUtils_popenCPP_H
2 #define CommonToolsUtils_popenCPP_H
3 #include <memory>
4 #include <string>
5 #include <sstream>
6 
7 namespace reco {
8  namespace exprEvalDetails {
9 
10  std::unique_ptr<std::istream> popenCPP(const std::string &cmdline);
11 
12  inline std::string execSysCommand(const std::string &cmdline) {
13  std::ostringstream n1;
14  {
15  auto s1 = popenCPP(cmdline + " 2>&1");
16  n1 << s1->rdbuf();
17  }
18  return n1.str();
19  }
20 
21  } // namespace exprEvalDetails
22 } // namespace reco
23 
24 #endif // CommonToolsUtils__popenCPP_H
std::string execSysCommand(const std::string &cmdline)
Definition: popenCPP.h:12
std::unique_ptr< std::istream > popenCPP(const std::string &cmdline)
Definition: popenCPP.cc:33