diff options
author | Pixel <Pixel> | 2001-11-26 23:11:40 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2001-11-26 23:11:40 +0000 |
commit | 3baa9d168c02a8734b95d1cc467601b6aaf2f6e4 (patch) | |
tree | 6c254e9d75dee5a1e305283788fea3d3fff2a445 /lib/InPipe.cc | |
parent | 3aa63fcbddbce8762ad0f3f54d90ad985c0f9c41 (diff) |
Big job here. Many bugs out. Hurray!!
Diffstat (limited to 'lib/InPipe.cc')
-rw-r--r-- | lib/InPipe.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/InPipe.cc b/lib/InPipe.cc new file mode 100644 index 0000000..60f3751 --- /dev/null +++ b/lib/InPipe.cc @@ -0,0 +1,31 @@ +#include "InPipe.h" +#include "Output.h" + +InPipe::InPipe() : Handle(pipe(p, 0)), hooked(0) { } + +InPipe::~InPipe() { + if (hooked) { + ::close(1); + dup(Stdout.GetHandle()); + } +} + +void InPipe::Hook() { + if (!hooked) { + hooked = 1; + ::close(1); + dup(p[1]); + } +} + +bool InPipe::CanWrite() { + return false; +} + +bool InPipe::CanRead() { + return true; +} + +String InPipe::GetName() { + return (String("Input pipe from stdout (") + (hooked ? "" : "not ") + "hooked)"); +} |