00001
00002
00003
00004
00005
00006
00007 #ifndef __WVPIPE_H
00008 #define __WVPIPE_H
00009
00010 #include "wvfdstream.h"
00011 #include "wvsubproc.h"
00012
00032 class WvPipe : public WvFDStream
00033 {
00034 WvSubProc proc;
00035 protected:
00036 void setup(const char *program, const char * const *argv,
00037 bool writable, bool readable, bool catch_stderr,
00038 int stdin_fd, int stdout_fd, int stderr_fd);
00039 public:
00053 WvPipe(const char *program, const char * const *argv,
00054 bool writable, bool readable, bool catch_stderr,
00055 int stdin_fd = 0, int stdout_fd = 1, int stderr_fd = 2);
00056
00070 WvPipe(const char *program, const char * const *argv,
00071 bool writable, bool readable, bool catch_stderr,
00072 WvFDStream *stdin_str, WvFDStream *stdout_str = NULL,
00073 WvFDStream *stderr_str = NULL);
00074
00079 WvPipe(const char *program, const char **argv,
00080 bool writable, bool readable, bool catch_stderr,
00081 WvFDStream *stdio_str);
00082
00084 virtual ~WvPipe();
00085
00090 void kill(int signum);
00091
00093 int finish(bool wait_children = true);
00094
00096 bool child_exited();
00097
00099 bool child_killed() const;
00100
00106 int exit_status();
00107
00108
00109 int getpid() const { return proc.pid; };
00110
00111
00112 static void ignore_read(WvStream& s, void *userdata);
00113
00114 public:
00115 const char *wstype() const { return "WvPipe"; }
00116 };
00117
00118 #endif // __WVPIPE_H