#include <ExternalProgram.h>
Inheritance diagram for zypp::ExternalProgram:
Public Types | |
typedef std::map< std::string, std::string > | Environment |
For passing additional environment variables to set. | |
enum | Stderr_Disposition { Normal_Stderr, Discard_Stderr, Stderr_To_Stdout, Stderr_To_FileDesc } |
Define symbols for different policies on the handling of stderr. More... | |
Public Member Functions | |
ExternalProgram (std::string commandline, Stderr_Disposition stderr_disp=Normal_Stderr, bool use_pty=false, int stderr_fd=-1, bool default_locale=false, const Pathname &root="") | |
Start the external program by using the shell /bin/sh | |
ExternalProgram () | |
Start an external program by giving the arguments as an arry of char *pointers. | |
ExternalProgram (const char *const *argv, Stderr_Disposition stderr_disp=Normal_Stderr, bool use_pty=false, int stderr_fd=-1, bool default_locale=false, const Pathname &root="") | |
ExternalProgram (const char *const *argv, const Environment &environment, Stderr_Disposition stderr_disp=Normal_Stderr, bool use_pty=false, int stderr_fd=-1, bool default_locale=false, const Pathname &root="") | |
ExternalProgram (const char *binpath, const char *const *argv_1, bool use_pty=false) | |
ExternalProgram (const char *binpath, const char *const *argv_1, const Environment &environment, bool use_pty=false) | |
~ExternalProgram () | |
int | close () |
Close the input and output streams. | |
bool | kill () |
Kill the program. | |
bool | running () |
Return whether program is running. | |
pid_t | getpid () |
return pid | |
Static Public Member Functions | |
static void | renumber_fd (int origfd, int newfd) |
origfd will be accessible as newfd and closed (unless they were equal) | |
Protected Member Functions | |
int | checkStatus (int) |
Private Member Functions | |
void | start_program (const char *const *argv, const Environment &environment, Stderr_Disposition stderr_disp=Normal_Stderr, int stderr_fd=-1, bool default_locale=false, const char *root=NULL) |
Private Attributes | |
bool | use_pty |
Set to true, if a pair of ttys is used for communication instead of a pair of pipes. | |
pid_t | pid |
int | _exitStatus |
It starts the program using fork and some exec.. call, gives you access to the program's stdio and closes the program after use.
Definition at line 34 of file ExternalProgram.h.
|
For passing additional environment variables to set.
Definition at line 52 of file ExternalProgram.h. |
|
Define symbols for different policies on the handling of stderr.
Definition at line 42 of file ExternalProgram.h. |
|
Start the external program by using the shell You can use io direction symbols < and >.
|
|
Start an external program by giving the arguments as an arry of char *pointers. If environment is provided, varaiables will be added to the childs environment, overwriting existing ones. Definition at line 36 of file ExternalProgram.cc. |
|
Definition at line 62 of file ExternalProgram.cc. References zypp::filesystem::Pathname::asString(), and zypp::filesystem::Pathname::empty(). |
|
Definition at line 78 of file ExternalProgram.cc. References zypp::filesystem::Pathname::asString(), and zypp::filesystem::Pathname::empty(). |
|
Definition at line 93 of file ExternalProgram.cc. References start_program(). |
|
Definition at line 108 of file ExternalProgram.cc. References start_program(). |
|
Definition at line 122 of file ExternalProgram.cc. |
|
Close the input and output streams.
Reimplemented from zypp::externalprogram::ExternalDataSource. Definition at line 292 of file ExternalProgram.cc. References _exitStatus, checkStatus(), and pid. Referenced by zypp::KeyRing::Impl::deleteKey(), zypp::debug::dumpMemOn(), zypp::KeyRing::Impl::importKey(), zypp::storage::XMLFilesBackend::isBackendInitialized(), kill(), renumber_fd(), zypp::media::Mount::Status(), zypp::target::rpm::RpmDb::systemStatus(), and zypp::KeyRing::Impl::verifyFile(). |
|
Kill the program.
Definition at line 356 of file ExternalProgram.cc. Referenced by zypp::media::Mount::Kill(), zypp::media::Mount::Status(), zypp::target::rpm::RpmDb::systemKill(), and zypp::target::rpm::RpmDb::systemStatus(). |
|
Return whether program is running.
Definition at line 368 of file ExternalProgram.cc. References _exitStatus, checkStatus(), ERR, pid, and zypp::str::strerror(). |
|
return pid
Definition at line 110 of file ExternalProgram.h. References pid. Referenced by zypp::target::rpm::RpmDb::doRebuildDatabase(). |
|
origfd will be accessible as newfd and closed (unless they were equal)
Definition at line 392 of file ExternalProgram.cc. References close(). |
|
Definition at line 320 of file ExternalProgram.cc. |
|
Definition at line 128 of file ExternalProgram.cc. References _exitStatus, DBG, ERR, pid, and use_pty. Referenced by ExternalProgram(). |
|
Set to true, if a pair of ttys is used for communication instead of a pair of pipes.
Definition at line 126 of file ExternalProgram.h. Referenced by start_program(). |
|
Definition at line 128 of file ExternalProgram.h. Referenced by checkStatus(), close(), getpid(), kill(), running(), and start_program(). |
|
Definition at line 129 of file ExternalProgram.h. Referenced by close(), running(), and start_program(). |