19 #include "CommandExecuter.hpp"
31 HCE::Process::Args
args;
33 std::stringstream
inMsg(
"def\nabc\n123\n");
34 std::stringstream outMsg, errMsg;
35 HCE::Process::Env
env = {{
"key1",
"value1"}};
43 std::cout <<
"cout: " << outMsg.str() <<
std::endl;
44 std::cout <<
"cerr: " << errMsg.str() <<
std::endl;
47 catch(std::exception& e)
49 std::cerr <<
"Exception: " << e.what() <<
std::endl;
58 HCE::Process::Args
args = {
"-r"};
59 std::stringstream
inMsg(
"def\nabc\n123\n");
60 std::stringstream outMsg, errMsg;
68 std::cout <<
"cout: " << outMsg.str() <<
std::endl;
69 std::cout <<
"cerr: " << errMsg.str() <<
std::endl;
72 catch(std::exception& e)
74 std::cerr <<
"Exception: " << e.what() <<
std::endl;
83 HCE::Process::Args
args = {
"5"};
84 std::stringstream
inMsg, outMsg, errMsg;
94 std::cout <<
"cout: " << outMsg.str() <<
std::endl;
95 std::cout <<
"cerr: " << errMsg.str() <<
std::endl;
97 catch(std::exception& e)
99 std::cerr <<
"Exception: " << e.what() <<
std::endl;
108 HCE::Process::Args
args = {
"auxf"};
118 catch(std::exception& e)
120 std::cerr <<
"Exception: " << e.what() <<
std::endl;
129 HCE::Process::Args
args = {
"-r"};
130 std::stringstream
inMsg(
"def\nabc\n123\n");
132 std::stringstream outMsg, errMsg;
134 std::cout <<
"Exec: " << std::boolalpha << procExec.
exec(inMsg, outMsg, errMsg) <<
std::endl;
135 std::cout <<
"isError: " << std::boolalpha << procExec.
isError() <<
std::endl;
136 std::cout <<
"Out: " << outMsg.str() <<
std::endl;
137 std::cout <<
"Err: " << errMsg.str() <<
std::endl;
144 std::string
command =
"sort -r";
145 std::string shell =
"bash -c";
146 std::stringstream
inMsg(
"def\nabc\n123\n");
151 HCE::CommandExecuter commandExecuter;