libzypp 17.37.17
|
#include <zypp-core/zyppng/io/private/abstractspawnengine_p.h>
Public Types | |
using | Environment = std::map<std::string,std::string> |
For passing additional environment variables to set. |
Public Member Functions | |
AbstractSpawnEngine () | |
virtual | ~AbstractSpawnEngine () |
int | exitStatus () const |
void | setExitStatus (const int state) |
const std::string & | executedCommand () const |
const std::string & | execError () const |
void | setExecError (const std::string &str) |
zypp::Pathname | chroot () const |
void | setChroot (const zypp::Pathname &chroot) |
bool | useDefaultLocale () const |
void | setUseDefaultLocale (bool defaultLocale) |
Environment | environment () const |
void | setEnvironment (const Environment &environment) |
pid_t | pid () |
virtual bool | start (const char *const *argv, int stdin_fd, int stdout_fd, int stderr_fd)=0 |
virtual bool | waitForExit (const std::optional< uint64_t > &timeout={})=0 |
virtual bool | isRunning (bool wait=false)=0 |
virtual void | notifyExited (int status) |
bool | dieWithParent () const |
void | setDieWithParent (bool dieWithParent) |
bool | switchPgid () const |
void | setSwitchPgid (bool switchPgid) |
zypp::Pathname | workingDirectory () const |
void | setWorkingDirectory (const zypp::Pathname &workingDirectory) |
const std::vector< int > & | fdsToMap () const |
void | addFd (int fd) |
int | checkStatus (int status) |
Static Public Member Functions | |
static std::unique_ptr< zyppng::AbstractSpawnEngine > | createDefaultEngine () |
Protected Attributes | |
bool | _useDefaultLocale = false |
bool | _dieWithParent = false |
Should the process die with the parent process. | |
bool | _switchPgid = false |
pid_t | _pid = -1 |
int | _exitStatus = 0 |
std::string | _execError |
Remember execution errors like failed fork/exec. | |
std::string | _executedCommand |
Store the command we're executing. | |
std::vector< std::string > | _args |
The arguments we want to pass to the program. | |
Environment | _environment |
Environment variables to set in the new process. | |
zypp::Pathname | _chroot |
Path to chroot into. | |
zypp::Pathname | _workingDirectory |
Working directory. | |
std::vector< int > | _mapFds |
Additional file descriptors we want to map to the new process. |
This implements the basic skeleton of ExternalProgram and Process. Taking care of forking the process and setting up stdout and stderr so both implementations can use the same code
Definition at line 21 of file abstractspawnengine_p.h.
using zyppng::AbstractSpawnEngine::Environment = std::map<std::string,std::string> |
For passing additional environment variables to set.
Definition at line 28 of file abstractspawnengine_p.h.
zyppng::AbstractSpawnEngine::AbstractSpawnEngine | ( | ) |
Definition at line 57 of file abstractspawnengine.cc.
|
virtual |
Definition at line 61 of file abstractspawnengine.cc.
|
static |
Definition at line 64 of file abstractspawnengine.cc.
int zyppng::AbstractSpawnEngine::exitStatus | ( | ) | const |
Definition at line 115 of file abstractspawnengine.cc.
void zyppng::AbstractSpawnEngine::setExitStatus | ( | const int | state | ) |
Definition at line 120 of file abstractspawnengine.cc.
const std::string & zyppng::AbstractSpawnEngine::executedCommand | ( | ) | const |
Definition at line 125 of file abstractspawnengine.cc.
const std::string & zyppng::AbstractSpawnEngine::execError | ( | ) | const |
Definition at line 130 of file abstractspawnengine.cc.
void zyppng::AbstractSpawnEngine::setExecError | ( | const std::string & | str | ) |
Definition at line 135 of file abstractspawnengine.cc.
zypp::Pathname zyppng::AbstractSpawnEngine::chroot | ( | ) | const |
Definition at line 140 of file abstractspawnengine.cc.
void zyppng::AbstractSpawnEngine::setChroot | ( | const zypp::Pathname & | chroot | ) |
Definition at line 145 of file abstractspawnengine.cc.
bool zyppng::AbstractSpawnEngine::useDefaultLocale | ( | ) | const |
Definition at line 150 of file abstractspawnengine.cc.
void zyppng::AbstractSpawnEngine::setUseDefaultLocale | ( | bool | defaultLocale | ) |
Definition at line 155 of file abstractspawnengine.cc.
AbstractSpawnEngine::Environment zyppng::AbstractSpawnEngine::environment | ( | ) | const |
Definition at line 160 of file abstractspawnengine.cc.
void zyppng::AbstractSpawnEngine::setEnvironment | ( | const Environment & | environment | ) |
Definition at line 165 of file abstractspawnengine.cc.
pid_t zyppng::AbstractSpawnEngine::pid | ( | ) |
Definition at line 170 of file abstractspawnengine.cc.
|
pure virtual |
Kickstart the process, if this returns true it is guaranteed that exec() was successful
Implemented in zyppng::ForkSpawnEngine.
|
pure virtual |
Implemented in zyppng::AbstractDirectSpawnEngine.
Implemented in zyppng::AbstractDirectSpawnEngine.
|
virtual |
Used to notify the backend that the process has ended, helpful when the process is tracked in another way than calling isRunning, for example in a eventloop.
Definition at line 99 of file abstractspawnengine.cc.
bool zyppng::AbstractSpawnEngine::dieWithParent | ( | ) | const |
Definition at line 105 of file abstractspawnengine.cc.
void zyppng::AbstractSpawnEngine::setDieWithParent | ( | bool | dieWithParent | ) |
Definition at line 110 of file abstractspawnengine.cc.
bool zyppng::AbstractSpawnEngine::switchPgid | ( | ) | const |
Definition at line 69 of file abstractspawnengine.cc.
void zyppng::AbstractSpawnEngine::setSwitchPgid | ( | bool | switchPgid | ) |
Definition at line 74 of file abstractspawnengine.cc.
zypp::Pathname zyppng::AbstractSpawnEngine::workingDirectory | ( | ) | const |
Definition at line 79 of file abstractspawnengine.cc.
void zyppng::AbstractSpawnEngine::setWorkingDirectory | ( | const zypp::Pathname & | workingDirectory | ) |
Definition at line 84 of file abstractspawnengine.cc.
const std::vector< int > & zyppng::AbstractSpawnEngine::fdsToMap | ( | ) | const |
Definition at line 89 of file abstractspawnengine.cc.
void zyppng::AbstractSpawnEngine::addFd | ( | int | fd | ) |
Definition at line 94 of file abstractspawnengine.cc.
int zyppng::AbstractSpawnEngine::checkStatus | ( | int | status | ) |
Definition at line 175 of file abstractspawnengine.cc.
|
protected |
Definition at line 87 of file abstractspawnengine_p.h.
|
protected |
Should the process die with the parent process.
Definition at line 89 of file abstractspawnengine_p.h.
|
protected |
Definition at line 91 of file abstractspawnengine_p.h.
|
protected |
Definition at line 93 of file abstractspawnengine_p.h.
|
protected |
Definition at line 94 of file abstractspawnengine_p.h.
|
protected |
Remember execution errors like failed fork/exec.
Definition at line 96 of file abstractspawnengine_p.h.
|
protected |
Store the command we're executing.
Definition at line 98 of file abstractspawnengine_p.h.
|
protected |
The arguments we want to pass to the program.
Definition at line 100 of file abstractspawnengine_p.h.
|
protected |
Environment variables to set in the new process.
Definition at line 102 of file abstractspawnengine_p.h.
|
protected |
Path to chroot into.
Definition at line 104 of file abstractspawnengine_p.h.
|
protected |
Working directory.
Definition at line 106 of file abstractspawnengine_p.h.
|
protected |
Additional file descriptors we want to map to the new process.
Definition at line 108 of file abstractspawnengine_p.h.