blob: 978d24bb8ea26990adaacdeb40963e5953fed897 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include "InPipe.h"
#include "Output.h"
#include "config.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]);
::close(p[1]);
}
}
bool InPipe::CanWrite() {
return false;
}
bool InPipe::CanRead() {
return true;
}
String InPipe::GetName() {
return (String(_("Input pipe from stdout (")) + (hooked ? "" : _("not ")) + _("hooked)"));
}
|