File indexing completed on 2024-04-06 12:01:20
0001 #include "CommonTools/Utils/src/popenCPP.h"
0002 #include "FWCore/Utilities/interface/Exception.h"
0003 #include <iostream>
0004 #include <string>
0005
0006 using namespace reco::exprEvalDetails;
0007
0008 int main() {
0009 try {
0010 char c;
0011 {
0012 auto ss = popenCPP("c++ -v 2>&1");
0013 while (ss->get(c))
0014 std::cout << c;
0015 std::cout << std::endl;
0016 }
0017
0018 {
0019 auto n1 = execSysCommand("c++ -v");
0020 std::cout << "\n|" << n1 << '|' << std::endl;
0021 }
0022
0023 std::cout << "\n|" << execSysCommand("uuidgen | sed 's/-//g'") << '|' << std::endl;
0024
0025 std::cout << "\n|" << execSysCommand("notexisting 2>&1") << '|' << std::endl;
0026
0027 } catch (cms::Exception const& e) {
0028 std::cout << e.what() << std::endl;
0029 } catch (...) {
0030 std::cout << "unknown error...." << std::endl;
0031 }
0032
0033 return 0;
0034 }