Apache Mesos
|
Represents a fork() exec()ed subprocess. More...
#include <subprocess.hpp>
Classes | |
class | ChildHook |
A ChildHook can be passed to a subprocess call. More... | |
class | IO |
Describes how the I/O is redirected for stdin/stdout/stderr. More... | |
struct | ParentHook |
A hook can be passed to a subprocess call. More... | |
Public Member Functions | |
pid_t | pid () const |
Option< int_fd > | in () const |
Option< int_fd > | out () const |
Option< int_fd > | err () const |
Future< Option< int > > | status () const |
Exit status of this subprocess captured as a Future (completed when the subprocess exits). More... | |
Static Public Member Functions | |
static IO | PIPE () |
static IO | PATH (const std::string &path) |
static IO | FD (int_fd fd, IO::FDType type=IO::DUPLICATED) |
Friends | |
Try< Subprocess > | subprocess (const std::string &path, std::vector< std::string > argv, const Subprocess::IO &in, const Subprocess::IO &out, const Subprocess::IO &err, const flags::FlagsBase *flags, const Option< std::map< std::string, std::string >> &environment, const Option< lambda::function< pid_t(const lambda::function< int()> &)>> &clone, const std::vector< Subprocess::ParentHook > &parent_hooks, const std::vector< Subprocess::ChildHook > &child_hooks, const std::vector< int_fd > &whitelist_fds) |
Represents a fork() exec()ed subprocess.
Access is provided to the input / output of the process, as well as the exit status. The input / output file descriptors are only closed after:
|
static |
|
static |
|
inline |
|
static |
Exit status of this subprocess captured as a Future (completed when the subprocess exits).
On Posix, the exit status is propagated from an underlying call to waitpid
and can be used with macros defined in wait.h, i.e., WIFEXITED(status)
.
On Windows, the exit status contains the exit code from an underlying call to GetExitCodeProcess()
.
TODO(alexr): Ensure the code working with status
is portable by either making WIFEXITED
family macros no-op on Windows or converting status
to a tuple <termination status, exit code>, see MESOS-7242.
NOTE: Discarding this future has no effect on the subprocess!
process::reap()
of this subprocess. Note that process::reap()
never fails or discards this future.
|
friend |