27 #ifndef Common_ServerLauncher_h
28 #define Common_ServerLauncher_h
36 #include <sys/types.h>
38 #include <sys/types.h>
68 const char *outfile = 0,
bool append_output =
false) {
81 open_flags = O_CREAT | O_APPEND | O_RDWR;
83 open_flags = O_CREAT | O_TRUNC | O_WRONLY,
85 outfd = open(outfile, open_flags, 0644);
100 std::this_thread::sleep_for(std::chrono::milliseconds(2000));
106 << std::endl << std::flush;
137 #endif // Common_ServerLauncher_h
Launches external commands and redirects their output to a file; kills the external process when goin...
pid_t get_pid() const
Returns the pid of the external program.
~ServerLauncher()
Destructor; kills the external program.
pid_t m_child_pid
The pid of the external program.
const char * m_path
The path of the external program.
int get_write_descriptor() const
Returns stdin of the external program.
ServerLauncher(const char *path, char *const argv[], const char *outfile=0, bool append_output=false)
Constructor; launches the external command, optionally redirects the output.
int m_write_fd
The file descriptor writing to stdin of the external program.