14 #include <boost/system/error_code.hpp>
15 #include <boost/system/system_error.hpp>
26 template <
class PosixExecutor>
29 if (::
pipe(fds_) == -1)
31 BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR(
"pipe(2) failed");
33 if (::fcntl(fds_[1], F_SETFD, FD_CLOEXEC) == -1)
39 boost::system::error_code(e, boost::system::system_category()),
40 BOOST_PROCESS_SOURCE_LOCATION
"fcntl(2) failed"));
44 template <
class PosixExecutor>
51 boost::system::error_code(e, boost::system::system_category()),
52 BOOST_PROCESS_SOURCE_LOCATION
"fork(2) failed"));
55 template <
class PosixExecutor>
60 if (::
read(fds_[0], &code,
sizeof(
int)) > 0)
64 boost::system::error_code(code,
65 boost::system::system_category()),
66 BOOST_PROCESS_SOURCE_LOCATION
"execve(2) failed"));
71 template <
class PosixExecutor>
77 template <
class PosixExecutor>
81 while (::
write(fds_[1], &e,
sizeof(
int)) == -1 && errno == EINTR)