#include "OutPipe.h" #include "Input.h" OutPipe::OutPipe() : Handle(pipe(p, 1)), hooked(0) { } OutPipe::~OutPipe() { if (hooked) { ::close(0); dup(Stdin.GetHandle()); } } void OutPipe::Hook() { if (!hooked) { hooked = 1; ::close(0); dup(p[0]); } } bool OutPipe::CanWrite() { return false; } bool OutPipe::CanRead() { return true; } String OutPipe::GetName() { return (String("Input pipe from stdout (") + (hooked ? "" : "not ") + "hooked)"); }