diff options
Diffstat (limited to 'project2/processes/processStream.cpp')
-rw-r--r-- | project2/processes/processStream.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/project2/processes/processStream.cpp b/project2/processes/processStream.cpp index 3067533..a4b5567 100644 --- a/project2/processes/processStream.cpp +++ b/project2/processes/processStream.cpp @@ -1,11 +1,10 @@ #include "iHaveParameters.h" #include "scriptLoader.h" -#include "scopeObject.h" +#include <processPipes.h> #include "scripts.h" #include "stream.h" #include <exception> #include <sys/wait.h> -#include <misc.h> SimpleMessageException(SubProcessFailedToStart); SimpleMessageException(SubProcessFailed); @@ -28,15 +27,9 @@ class ProcessStream : public Stream, IHaveParameters { for (const Parameters::value_type & p : parameters) { callProc.push_back(p.second(ec)); } - int fds[2]; - popenrw(callProc, fds); - - ScopeObject doClose([&] { - close(fds[0]); - close(fds[1]); - }); + AdHoc::System::ProcessPipes fds(callProc, false, true, false); char buf[BUFSIZ]; - while (ssize_t r = read(fds[1], buf, BUFSIZ) != 0) { + while (ssize_t r = read(fds.fdOut(), buf, BUFSIZ) != 0) { if (r < 0) { throw syscall_error(errno); } |