Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

ExternalProgram.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013    File:       ExternalProgram.h
00014 
00015    Author:     Andreas Schwab <schwab@suse.de>
00016    Maintainer: Thomas Roelz <tom@suse.de>
00017 
00018 /-*/
00019 
00020 #ifndef ExternalProgram_h
00021 #define ExternalProgram_h
00022 
00023 #include <y2util/ExternalDataSource.h>
00024 #include <y2util/Pathname.h>
00025 
00033 class ExternalProgram : public ExternalDataSource
00034 {
00035 
00036 public:
00041     enum Stderr_Disposition {
00042         Normal_Stderr,
00043         Discard_Stderr,
00044         Stderr_To_Stdout,
00045         Stderr_To_FileDesc
00046     };
00047 
00056     ExternalProgram (std::string commandline,
00057                      Stderr_Disposition stderr_disp = Normal_Stderr,
00058                      bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
00059                      const Pathname& root = "");
00060 
00064     ExternalProgram (const char *const *argv,
00065                      Stderr_Disposition stderr_disp = Normal_Stderr,
00066                      bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
00067                      const Pathname& root = "");
00068 
00069     ExternalProgram (const char *binpath, const char *const *argv_1,
00070                      bool use_pty = false);
00071 
00072 /*
00073     ExternalProgram (const YCPList &, const char *binpath = 0,
00074                      bool use_pty = false);
00075 */
00076     // ExternalProgram(const YCPTermRep *);
00077 
00078     ~ExternalProgram();
00079 
00080     int close();
00081 
00085     bool kill();
00086 
00090     bool running();
00091 
00095     pid_t getpid() { return pid; }
00096 
00097 protected:
00098     int checkStatus( int );
00099 
00100 private:
00101 
00106     bool use_pty;
00107 
00108     pid_t pid;
00109     int _exitStatus;
00110 
00111     void start_program (const char *const *argv,
00112                         Stderr_Disposition stderr_disp = Normal_Stderr,
00113                         int stderr_fd = -1, bool default_locale = false,
00114                         const char* root = NULL);
00115 
00116 };
00117 
00118 #endif // ExternalProgram_h

Generated on Thu Feb 23 23:56:10 2006 for liby2util by doxygen 1.3.6