10 #ifndef BOOSTER_SEAT_PROCESS_HPP_
11 #define BOOSTER_SEAT_PROCESS_HPP_
18 #include <ext/stdio_filebuf.h>
19 #include <sys/types.h>
35 Process(
const std::string &cmd, std::vector<std::string> argv);
55 void run(
const std::string &cmd, std::vector<std::string> argv);
56 void child(
const std::vector<std::string> &argv);
A class to handle linux process calls.
Definition: process.hpp:33
pid_t pid_
The process id of the child process.
Definition: process.hpp:59
~Process()
Definition: process.cpp:23
int getExitCode()
Definition: process.cpp:52
std::string stderr_string_
The stderr of the process.
Definition: process.hpp:93
void writeToInStream(const std::string &s)
Definition: process.cpp:34
Process(const std::string &cmd, std::vector< std::string > argv)
Definition: process.cpp:13
std::istream * out_stream_
The output stream for the child process.
Definition: process.hpp:78
std::istream * err_stream_
The error stream for the child process.
Definition: process.hpp:80
const std::string & getStdout()
Definition: process.cpp:42
__gnu_cxx::stdio_filebuf< char > * p_err_filebuf_
The filebuf for error pipe.
Definition: process.hpp:73
void run(const std::string &cmd, std::vector< std::string > argv)
Definition: process.cpp:106
void child(const std::vector< std::string > &argv)
Definition: process.cpp:142
int in_pipe_[2]
The file descriptors for input pipe.
Definition: process.hpp:62
void waitToComplete(unsigned int timeout=1000)
Waits for the process to complete. If the process does not complete within the timeout,...
Definition: process.cpp:64
int out_pipe_[2]
The file descriptors for output pipe.
Definition: process.hpp:64
void closeInStream()
Definition: process.cpp:38
void assertComplete()
Definition: process.cpp:95
int exit_code_
The exit code of the process.
Definition: process.hpp:89
__gnu_cxx::stdio_filebuf< char > * p_in_filebuf_
The filebuf for input pipe.
Definition: process.hpp:69
int err_pipe_[2]
The file descriptors for error pipe.
Definition: process.hpp:66
std::string stdout_string_
The stdout of the process.
Definition: process.hpp:91
__gnu_cxx::stdio_filebuf< char > * p_out_filebuf_
The filebuf for output pipe.
Definition: process.hpp:71
bool have_exit_code_
Set to true when the process has completed and an exit code has been retrieved. This is used internal...
Definition: process.hpp:86
const std::string & getStderr()
Definition: process.cpp:47
std::ostream * in_stream_
The input stream for the child process.
Definition: process.hpp:76
Definition: filesystem.cpp:34