00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
00074
00075
00076
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