summaryrefslogtreecommitdiff
path: root/lib/InPipe.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/InPipe.cc')
-rw-r--r--lib/InPipe.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/InPipe.cc b/lib/InPipe.cc
index efcab10..4a69b5e 100644
--- a/lib/InPipe.cc
+++ b/lib/InPipe.cc
@@ -5,10 +5,10 @@
#include "Output.h"
#include "gettext.h"
-InPipe::InPipe() : Handle(pipe(p, 0)), hooked(0) {
+InPipe::InPipe() : Handle(pipe(p, 0)), hooked(false), halfclosed(false) {
}
-InPipe::InPipe(const InPipe & i) : Handle(i), hooked(i.hooked) {
+InPipe::InPipe(const InPipe & i) : Handle(i), hooked(i.hooked), halfclosed(i.halfclosed) {
p[0] = GetHandle();
p[1] = dup(i.p[1]);
}
@@ -22,13 +22,20 @@ InPipe::~InPipe() {
void InPipe::Hook() {
if (!hooked) {
- hooked = 1;
+ hooked = true;
::close(1);
dup(p[1]);
::close(p[1]);
}
}
+void InPipe::HalfClose() {
+ if (!halfclosed) {
+ ::close(p[1]);
+ halfclosed = true;
+ }
+}
+
bool InPipe::CanWrite() {
return false;
}