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:
00049 WvPipe(const char *program, const char * const *argv,
00050 bool writable, bool readable, bool catch_stderr,
00051 int stdin_fd = 0, int stdout_fd = 1, int stderr_fd = 2);
00052
00066 WvPipe(const char *program, const char * const *argv,
00067 bool writable, bool readable, bool catch_stderr,
00068 WvFDStream *stdin_str, WvFDStream *stdout_str = NULL,
00069 WvFDStream *stderr_str = NULL);
00070
00075 WvPipe(const char *program, const char **argv,
00076 bool writable, bool readable, bool catch_stderr,
00077 WvFDStream *stdio_str);
00078
00080 virtual ~WvPipe();
00081
00086 void kill(int signum);
00087
00089 int finish(bool wait_children = true);
00090
00092 bool child_exited();
00093
00095 bool child_killed() const;
00096
00102 int exit_status();
00103
00104
00105 int getpid() const { return proc.pid; };
00106
00107
00108 static void ignore_read(WvStream& s, void *userdata);
00109 };
00110
00111 #endif // __WVPIPE_H