00001
00002
00003
00004
00005 #ifndef __WVPIPE_H
00006 #define __WVPIPE_H
00007
00008 #include "wvstream.h"
00009
00010 class WvSplitStream;
00011
00031 class WvPipe : public WvStream
00032 {
00033 pid_t pid;
00034 int estatus;
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 WvStream *stdin_str, WvStream *stdout_str = NULL,
00069 WvStream *stderr_str = NULL);
00070
00075 WvPipe(const char *program, const char **argv,
00076 bool writable, bool readable, bool catch_stderr,
00077 WvSplitStream *stdio_str);
00078
00082 virtual ~WvPipe();
00083
00088 void kill(int signum);
00089
00093 int finish();
00094
00098 bool child_exited();
00099
00103 bool child_killed() const;
00104
00110 int exit_status() const;
00111
00112
00113 int getpid() const { return pid; };
00114 };
00115
00116 #endif // __WVPIPE_H