添加 'SubProcessIO.h'

This commit is contained in:
Kirigaya Kazuto 2017-06-01 19:43:47 +08:00
parent 61aef41551
commit e576d13a4f

24
SubProcessIO.h Normal file
View File

@ -0,0 +1,24 @@
#pragma once
#include <string>
#include <stdexcept>
class SubProcessIO
{
public:
SubProcessIO(const std::string& Command,bool TerminateOnDestruct=false) throw(std::runtime_error);
SubProcessIO(const SubProcessIO& )=delete;
~SubProcessIO();
int writeToSubProcess(const char* buffer,int szToWrite);
int peekSubProcess();
int readFromSubProcess(char* buffer,int szToRead);
int wait();
int wait(int ms);
int getExitCode();
int terminate();
void detach();
protected:
int createSubProcessWith(const std::string& Command);
private:
struct _impl;
_impl* _pimpl;
};