1 #include "hmbdc/Copyright.hpp" 4 #include "hmbdc/Exception.hpp" 15 namespace hmbdc {
namespace os {
30 ,
bool captureStderr =
false);
63 auto s = write(exeStdinFd, input, strlen(input));
64 if ((
size_t)s != strlen(input)) {
65 HMBDC_THROW(runtime_error,
"write failed, bytes written=" << s);
71 auto s = write(exeStdinFd, input.c_str(), input.size());
72 if ((
size_t)s != input.size()) {
73 HMBDC_THROW(runtime_error,
"write failed, bytes written=" << s);
80 auto l = std::find(buf_, buf_ + bufLen_,
'\n');
82 if (l == buf_ +
sizeof(buf_)) l--;
83 if (l != buf_ + bufLen_) {
84 output = string(buf_, l + 1);
85 bufLen_ -= output.size();
86 memmove(buf_, l + 1, bufLen_);
89 int s = read(exeStdoutFd, buf_ + bufLen_,
sizeof(buf_) - bufLen_);
96 int s = read(exeStderrFd, buf,
sizeof(buf));
97 output = string(buf, s);
Definition: TypedString.hpp:74
pid_t exePid
process id of the started child process
Definition: ExecutionIo.hpp:55
int exeStderrFd
if captured, child stderr fd, use read on it - not write
Definition: ExecutionIo.hpp:50
int exeStdoutFd
child stdout fd, use read on it - not write
Definition: ExecutionIo.hpp:44
execute a program as a child and capture its stdin stdout and/or stderr
Definition: ExecutionIo.hpp:21
Definition: Client.hpp:11
int exeStdinFd
child stdin fd, use write on it - not read
Definition: ExecutionIo.hpp:38