#include <Exec.hpp>
Public Member Functions | |
| PopenStreams () | |
| ~PopenStreams () | |
| PopenStreams (const PopenStreams &src) | |
| PopenStreams & | operator= (const PopenStreams &src) |
| UnnamedPipeRef | in () const |
| Get a write-only pipe to the process's stdin. | |
| void | in (const UnnamedPipeRef &pipe) |
| Set a pipe to the process's stdin. | |
| UnnamedPipeRef | out () const |
| Get a read-only pipe to the process's stdout. | |
| void | out (const UnnamedPipeRef &pipe) |
| Set a pipe to the process's stdout. | |
| UnnamedPipeRef | err () const |
| Get a read-only pipe to the process's stderr. | |
| void | err (const UnnamedPipeRef &pipe) |
| Set a pipe to the process's stderr. | |
| Array< UnnamedPipeRef > | extraPipes () const |
| Get additional pipes that may be connected to the process. | |
| void | setExtraPipes (const Array< UnnamedPipeRef > &pipes) |
| Set additional pipes that may be connected to the process. | |
| ProcId | pid () const |
| Get the process's pid. | |
| void | pid (ProcId newPid) |
| Set the process's pid. | |
| int | getExitStatus (UInt32 wait_initial, UInt32 wait_close, UInt32 wait_term) |
| Waits for the process to terminate and returns its exit status. | |
| int | getExitStatus () |
| Same as getExitStatus(0, 10*1000, 10*1000);. | |
| void | setProcessStatus (int ps) |
| Sets the process's exit status. | |
Private Attributes | |
| IntrusiveReference < PopenStreamsImpl > | m_impl |
Friends | |
| bool | operator== (const PopenStreams &x, const PopenStreams &y) |
Definition at line 57 of file Exec.hpp.
| BLOCXX_NAMESPACE::PopenStreams::PopenStreams | ( | const PopenStreams & | src | ) |
| PopenStreams & BLOCXX_NAMESPACE::PopenStreams::operator= | ( | const PopenStreams & | src | ) |
| UnnamedPipeRef BLOCXX_NAMESPACE::PopenStreams::in | ( | ) | const |
Get a write-only pipe to the process's stdin.
Definition at line 353 of file Exec.cpp.
References m_impl.
Referenced by BLOCXX_NAMESPACE::Exec::safePopen().
| void BLOCXX_NAMESPACE::PopenStreams::in | ( | const UnnamedPipeRef & | pipe | ) |
| UnnamedPipeRef BLOCXX_NAMESPACE::PopenStreams::out | ( | ) | const |
Get a read-only pipe to the process's stdout.
Definition at line 363 of file Exec.cpp.
References m_impl.
Referenced by BLOCXX_NAMESPACE::Exec::safePopen().
| void BLOCXX_NAMESPACE::PopenStreams::out | ( | const UnnamedPipeRef & | pipe | ) |
| UnnamedPipeRef BLOCXX_NAMESPACE::PopenStreams::err | ( | ) | const |
Get a read-only pipe to the process's stderr.
Definition at line 373 of file Exec.cpp.
References m_impl.
Referenced by BLOCXX_NAMESPACE::Exec::safePopen().
| void BLOCXX_NAMESPACE::PopenStreams::err | ( | const UnnamedPipeRef & | pipe | ) |
| Array< UnnamedPipeRef > BLOCXX_NAMESPACE::PopenStreams::extraPipes | ( | ) | const |
| void BLOCXX_NAMESPACE::PopenStreams::setExtraPipes | ( | const Array< UnnamedPipeRef > & | pipes | ) |
| pid_t BLOCXX_NAMESPACE::PopenStreams::pid | ( | ) | const |
Get the process's pid.
If the process's exit status has already been read by calling getExitStatus(), then this will return -1
Definition at line 393 of file Exec.cpp.
References m_impl.
Referenced by BLOCXX_NAMESPACE::Exec::safePopen(), and BLOCXX_NAMESPACE::Exec::safeSystem().
| void BLOCXX_NAMESPACE::PopenStreams::pid | ( | ProcId | newPid | ) |
| int BLOCXX_NAMESPACE::PopenStreams::getExitStatus | ( | UInt32 | wait_initial, | |
| UInt32 | wait_close, | |||
| UInt32 | wait_term | |||
| ) |
Waits for the process to terminate and returns its exit status.
Takes increasingly severe measures to ensure that the process dies -- the following steps are taken in order until termination is detected:
1. If wait_initial > 0, waits wait_initial seconds for the process to die on its own.
2. If wait_close > 0, closes the input and output pipes and then waits wait_close seconds for the process to die.
3. If wait_term > 0, sends process a SIGTERM signal and waits wait_term seconds for it to die.
4. Sends the process a SIGKILL signal.
In steps 1-3 the function returns as soon as termination is detected. After calling this function the object is basically useless, except that if the function is called again it will return the same exit status without going through the above steps.
Note to maintainers: it is important that if wait_close == 0 then the pipes are NOT closed.
Wait times are no larger than 4294967 seconds.
| ExecErrorException,ThreadCancelledException |
Definition at line 408 of file Exec.cpp.
References m_impl.
| int BLOCXX_NAMESPACE::PopenStreams::getExitStatus | ( | ) |
| void BLOCXX_NAMESPACE::PopenStreams::setProcessStatus | ( | int | ps | ) |
Sets the process's exit status.
This function is used by Exec::gatherOutput()
Definition at line 413 of file Exec.cpp.
References m_impl.
| bool operator== | ( | const PopenStreams & | x, | |
| const PopenStreams & | y | |||
| ) | [friend] |
Definition at line 154 of file Exec.hpp.
Referenced by err(), extraPipes(), getExitStatus(), in(), operator=(), BLOCXX_NAMESPACE::operator==(), out(), pid(), setExtraPipes(), and setProcessStatus().
1.5.3