1 | #include "Poco/Process.h" |
---|
2 | #include "Poco/PipeStream.h" |
---|
3 | #include "Poco/StreamCopier.h" |
---|
4 | #include <sstream> |
---|
5 | #include <iostream> |
---|
6 | |
---|
7 | using Poco::Process; |
---|
8 | using Poco::ProcessHandle; |
---|
9 | |
---|
10 | int main(int argc, char** argv) |
---|
11 | { |
---|
12 | std::string cmd("/home/dmn58364/Builds/paraview-3.10/release/bin/paraview"); |
---|
13 | std::vector<std::string> args; |
---|
14 | args.push_back("-V"); |
---|
15 | Poco::Pipe outPipe, errPipe; |
---|
16 | ProcessHandle ph = Process::launch(cmd, args, 0, &outPipe, &errPipe); |
---|
17 | // Read from the pipes |
---|
18 | Poco::PipeInputStream stdout(outPipe), stderr(errPipe); |
---|
19 | std::ostringstream outStream, errStream; |
---|
20 | Poco::StreamCopier::copyStream(stdout, outStream); |
---|
21 | Poco::StreamCopier::copyStream(stderr, errStream); |
---|
22 | std::cout << "stdout =\"" << outStream.str() << "\"\n"; |
---|
23 | std::cout << "stderr =\"" << errStream.str() << "\"\n"; |
---|
24 | return 0; |
---|
25 | } |
---|
26 | |
---|