23 #ifndef _PLUGINS_OPENPRS_UTILS_PROC_H_
24 #define _PLUGINS_OPENPRS_UTILS_PROC_H_
26 #include <logging/logger.h>
28 #include <boost/asio.hpp>
39 SubProcess(
const char *progname,
const char *file,
const char *argv[],
const char *envp[]);
46 const std::string & file,
47 const std::vector<std::string> &argv,
48 const std::vector<std::string> &envp);
50 const std::string & file,
51 const std::vector<std::string> &argv,
52 const std::vector<std::string> &envp,
77 return pipe_stdout_r_;
85 return pipe_stderr_r_;
90 boost::asio::posix::stream_descriptor &
98 boost::asio::posix::stream_descriptor &
106 boost::asio::posix::stream_descriptor &
112 void kill(
int signum);
119 pid_t run_proc(
const char *file,
126 void run_proc(
const char *file,
const char *argv[],
const char *envp[]);
128 void start_log(
const char * logname,
130 boost::asio::posix::stream_descriptor &sd,
131 boost::asio::streambuf & buf);
132 void handle_log_line(
const char * logname,
134 boost::asio::posix::stream_descriptor &sd,
135 boost::asio::streambuf & buf,
136 boost::system::error_code ec,
140 std::string progname_;
147 boost::asio::io_service io_service_;
148 std::thread io_service_thread_;
149 boost::asio::io_service::work io_service_work_;
153 boost::asio::posix::stream_descriptor sd_stdin_;
154 boost::asio::posix::stream_descriptor sd_stdout_;
155 boost::asio::posix::stream_descriptor sd_stderr_;
157 boost::asio::streambuf buf_stdout_;
158 boost::asio::streambuf buf_stderr_;