271af306681f5e1c86abf03feda7dc22b2c864d2
1 #include "ForkAndExec.hpp"
10 ForkAndExec::ForkAndExec(const char *binary_
, char **argv_
)
14 if (pipe2(ready
, O_CLOEXEC
| O_NONBLOCK
)) {
16 perror("Server::start pipe2()");
17 throw system_error(error
, system_category());
21 ForkAndExec::~ForkAndExec() {
30 optional
<pid_t
> ForkAndExec::operator()() {
39 switch (pid_t pid
= fork()) {
44 perror("fork() && exec()");
48 pollfd fd
{ready
[0], 0, 0};
49 if (1 > poll(&fd
, 1, 5000)) {
50 cerr
<< "exec() timed out" << endl
;