summaryrefslogtreecommitdiff
path: root/processmodel/processmodel.cpp
blob: 19ad57fd6b5e5523f634bab86381d9882936b4e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "Poco/Process.h"
#include "Poco/PipeStream.h"
#include "Poco/StreamCopier.h"
#include <fstream>
#include <iostream>
using Poco::Process;
using Poco::ProcessHandle;

//1. make a basic executable that represents a render context
//get message passing going
//incorporate in REST server
//fill in the details

int main(int argc, char** argv)
{
	
	std::vector<std::string> args;
	args.push_back("-ax");
	if (argc>1) {
		std::string cmd=std::string(argv[1]);
		Poco::Pipe outPipe;
		Poco::Pipe inPipe;
		ProcessHandle ph = Process::launch(cmd, args, &inPipe, &outPipe, 0);
		Poco::PipeInputStream istr(outPipe);
		Poco::PipeOutputStream ostr(inPipe);
		//std::ofstream ostr("processes.txt");
		//
		while (true){
			Poco::StreamCopier::copyStream(istr,std::cout);
			//ostr<<std::cin;
			//std::cout<<istr;
		}
		return 0;
	}
	else std::cerr<<"usage: processmodel [executable]"<<std::endl;
}