proxygen
|
#include <Subprocess.h>
Public Types | |
enum | State { NOT_STARTED, RUNNING, EXITED, KILLED } |
Public Member Functions | |
ProcessReturnCode () | |
ProcessReturnCode (const ProcessReturnCode &p)=default | |
ProcessReturnCode & | operator= (const ProcessReturnCode &p)=default |
ProcessReturnCode (ProcessReturnCode &&p) noexcept | |
ProcessReturnCode & | operator= (ProcessReturnCode &&p) noexcept |
State | state () const |
bool | notStarted () const |
bool | running () const |
bool | exited () const |
bool | killed () const |
int | exitStatus () const |
int | killSignal () const |
bool | coreDumped () const |
std::string | str () const |
void | enforce (State state) const |
Static Public Member Functions | |
static ProcessReturnCode | makeNotStarted () |
static ProcessReturnCode | makeRunning () |
static ProcessReturnCode | make (int status) |
Private Member Functions | |
ProcessReturnCode (int rv) | |
Private Attributes | |
int | rawStatus_ |
Static Private Attributes | |
static constexpr int | RV_NOT_STARTED = -2 |
static constexpr int | RV_RUNNING = -1 |
Definition at line 129 of file Subprocess.h.
Enumerator | |
---|---|
NOT_STARTED | |
RUNNING | |
EXITED | |
KILLED |
Definition at line 131 of file Subprocess.h.
|
inline |
Definition at line 152 of file Subprocess.h.
References folly::pushmi::__adl::noexcept(), operator=(), and state().
Referenced by make(), makeNotStarted(), and makeRunning().
|
default |
|
noexcept |
Definition at line 62 of file Subprocess.cpp.
References RV_NOT_STARTED.
|
inlineexplicitprivate |
Definition at line 221 of file Subprocess.h.
bool folly::ProcessReturnCode::coreDumped | ( | ) | const |
Was a core file generated? Only valid if state() == KILLED; throws otherwise.
Definition at line 108 of file Subprocess.cpp.
References enforce(), KILLED, and rawStatus_.
Referenced by killed(), and str().
void folly::ProcessReturnCode::enforce | ( | State | state | ) | const |
Helper function to enforce a precondition based on this. Throws std::logic_error if in an unexpected state.
Definition at line 90 of file Subprocess.cpp.
Referenced by coreDumped(), exitStatus(), killed(), killSignal(), folly::Subprocess::poll(), and folly::Subprocess::wait().
|
inline |
Definition at line 180 of file Subprocess.h.
References EXITED, and state().
int folly::ProcessReturnCode::exitStatus | ( | ) | const |
Exit status. Only valid if state() == EXITED; throws otherwise.
Definition at line 98 of file Subprocess.cpp.
References enforce(), EXITED, and rawStatus_.
Referenced by killed(), str(), folly::SubprocessSpawnError::SubprocessSpawnError(), and TEST().
|
inline |
Definition at line 183 of file Subprocess.h.
References coreDumped(), enforce(), exitStatus(), KILLED, killSignal(), state(), str(), and string.
int folly::ProcessReturnCode::killSignal | ( | ) | const |
Signal that caused the process's termination. Only valid if state() == KILLED; throws otherwise.
Definition at line 103 of file Subprocess.cpp.
References enforce(), KILLED, and rawStatus_.
Referenced by killed(), str(), and TEST().
|
static |
Definition at line 54 of file Subprocess.cpp.
References ProcessReturnCode().
Referenced by makeRunning(), folly::Subprocess::poll(), and folly::Subprocess::wait().
|
inlinestatic |
Definition at line 140 of file Subprocess.h.
References ProcessReturnCode(), and RV_NOT_STARTED.
|
inlinestatic |
Definition at line 144 of file Subprocess.h.
References make(), ProcessReturnCode(), and RV_RUNNING.
Referenced by folly::Subprocess::spawnInternal().
|
inline |
Helper wrappers around state().
Definition at line 174 of file Subprocess.h.
References NOT_STARTED, and state().
Referenced by TEST().
|
default |
Referenced by ProcessReturnCode().
|
noexcept |
Definition at line 67 of file Subprocess.cpp.
References rawStatus_, and RV_NOT_STARTED.
|
inline |
Definition at line 177 of file Subprocess.h.
References RUNNING, and state().
Referenced by runParent(), and TEST().
ProcessReturnCode::State folly::ProcessReturnCode::state | ( | ) | const |
Process state. One of: NOT_STARTED: process hasn't been started successfully RUNNING: process is currently running EXITED: process exited (successfully or not) KILLED: process was killed by a signal.
Definition at line 74 of file Subprocess.cpp.
References folly::assume_unreachable(), EXITED, KILLED, NOT_STARTED, rawStatus_, RUNNING, RV_NOT_STARTED, and RV_RUNNING.
Referenced by enforce(), exited(), killed(), notStarted(), ProcessReturnCode(), running(), str(), and folly::SubprocessSpawnError::SubprocessSpawnError().
std::string folly::ProcessReturnCode::str | ( | ) | const |
String representation; one of "not started" "running" "exited with status <status>" "killed by signal <signal>" "killed by signal <signal> (core dumped)"
Definition at line 113 of file Subprocess.cpp.
References folly::assume_unreachable(), coreDumped(), EXITED, exitStatus(), KILLED, killSignal(), NOT_STARTED, RUNNING, and state().
Referenced by killed().
|
private |
Definition at line 225 of file Subprocess.h.
Referenced by coreDumped(), exitStatus(), killSignal(), operator=(), and state().
|
staticprivate |
Definition at line 222 of file Subprocess.h.
Referenced by makeNotStarted(), operator=(), ProcessReturnCode(), and state().
|
staticprivate |
Definition at line 223 of file Subprocess.h.
Referenced by makeRunning(), and state().