13 #ifndef ZYPP_EXTERNALPROGRAM_H
14 #define ZYPP_EXTERNALPROGRAM_H
92 bool use_pty =
false,
int stderr_fd = -1,
bool default_locale =
false,
93 const Pathname& root =
"");
117 bool use_pty =
false,
int stderr_fd = -1,
bool default_locale =
false,
118 const Pathname& root =
"");
122 bool use_pty =
false,
int stderr_fd = -1,
bool default_locale =
false,
123 const Pathname& root =
"");
127 bool use_pty =
false,
int stderr_fd = -1,
bool default_locale =
false,
128 const Pathname& root =
"");
132 bool use_pty =
false,
int stderr_fd = -1,
bool default_locale =
false,
133 const Pathname& root =
"");
204 std::ostream &
operator>>( std::ostream & out_r );
226 int stderr_fd = -1,
bool default_locale =
false,
227 const char* root = NULL);
232 namespace _ExternalProgram
274 bool stderrGetUpTo( std::string & retval_r,
const char delim_r,
bool returnDelim_r =
false );
293 #endif // ZYPP_EXTERNALPROGRAM_H
ExternalProgram()
Start an external program by giving the arguments as an arry of char *pointers.
Bidirectional stream to external data.
bool use_pty
Set to true, if a pair of ttys is used for communication instead of a pair of pipes.
std::ostream & operator>>(std::ostream &out_r)
Redirect all command output to an ostream.
bool kill()
Kill the program.
void _initStdErr()
Close write end of the pipe (childs end).
ExternalProgram extended to offer reading programs stderr.
const std::string & command() const
The command we're executing.
const std::string & execError() const
Some detail telling why the execution failed, if it failed.
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)
Helper providing pipe FDs for ExternalProgramWithStderr.
bool running()
Return whether program is running.
std::vector< std::string > Arguments
ExternalProgramWithStderr(const Arguments &argv_r)
bool stderrGetline(std::string &retval_r, bool returnDelim_r=false)
Read next complete line from stderr (nonblocking).
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
ExternalProgramWithStderr(const Arguments &argv_r, const Environment &environment_r)
Stderr_Disposition
Define symbols for different policies on the handling of stderr.
std::map< std::string, std::string > Environment
For passing additional environment variables to set.
bool stderrGetUpTo(std::string &retval_r, const char delim_r, bool returnDelim_r=false)
Read data up to delim_r from stderr (nonblocking).
std::string _execError
Remember execution errors like failed fork/exec.
int close()
Wait for the progamm to complete.
std::string _command
Store the command we're executing.
static void renumber_fd(int origfd, int newfd)
origfd will be accessible as newfd and closed (unless they were equal)