Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / zypp / ExternalProgram.h
index dd5b089..f3fc850 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef ZYPP_EXTERNALPROGRAM_H
 #define ZYPP_EXTERNALPROGRAM_H
 
+#include <unistd.h>
+
 #include <map>
 #include <string>
 #include <vector>
@@ -83,7 +85,7 @@ namespace zypp {
        * @param commandline a shell commandline that is appended to
        * <tt>/bin/sh -c</tt>.
        * @param default_locale whether to set LC_ALL=C before starting
-       * @param root directory to chroot into, / or empty to not chroot
+       * @param root directory to chroot into; or just 'cd' if '/'l;  nothing if empty
        */
       ExternalProgram (std::string commandline,
                     Stderr_Disposition stderr_disp = Normal_Stderr,
@@ -95,6 +97,9 @@ namespace zypp {
        * If environment is provided, varaiables will be added to the childs environment,
        * overwriting existing ones.
        *
+       * Initial args starting with \c # are discarded but some are treated specially:
+       *       #/[path] - chdir to /[path] before executing
+       *
        * Stdin redirection: If the \b 1st argument starts with a \b '<', the remaining
        * part is treated as file opened for reading on standard input (or \c /dev/null
        * if empty).
@@ -103,6 +108,10 @@ namespace zypp {
        *   const char* argv[] = { "</tmp/x", "cat", NULL };
        *   ExternalProgram prog( argv );
        * \endcode
+       *
+       * Stdout redirection: If the \b 1st argument starts with a \b '>', the remaining
+       * part is treated as file opened for writing on standard output (or \c /dev/null
+       * if empty).
        */
 
       ExternalProgram();
@@ -224,7 +233,7 @@ namespace zypp {
     };
 
 
-  namespace _ExternalProgram
+  namespace externalprogram
   {
     /** Helper providing pipe FDs for \ref ExternalProgramWithStderr.
      * Moved to a basse class because the pipe needs to be initialized
@@ -242,12 +251,12 @@ namespace zypp {
        FILE * _stderr;
        int _fds[2];
     };
-  }
+  } // namespace externalprogram
 
   /** ExternalProgram extended to offer reading programs stderr.
    * \see \ref ExternalProgram
    */
-  class ExternalProgramWithStderr : private _ExternalProgram::EarlyPipe, public ExternalProgram
+  class ExternalProgramWithStderr : private externalprogram::EarlyPipe, public ExternalProgram
   {
     public:
       ExternalProgramWithStderr( const Arguments & argv_r )
@@ -260,7 +269,7 @@ namespace zypp {
 
     public:
       /** Return \c FILE* to read programms stderr (O_NONBLOCK set). */
-      _ExternalProgram::EarlyPipe::stderr;
+      using externalprogram::EarlyPipe::stderr;
 
       /** Read data up to \c delim_r from stderr (nonblocking).
        * \note If \c delim_r is '\0', we read as much data as possible.