Browse Source

Correct Child so that stderr and stdout from the child are

sent to the same output.

Deprecate ChildStream instead of correcting ChildStream.


git-svn-id: https://svn.microneil.com/svn/CodeDweller/branches/adeniz_1@98 d34b734f-a00e-4b39-a726-e4eeb87269ab
adeniz_1
adeniz 9 years ago
parent
commit
4af1aca886
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      child.cpp

+ 10
- 2
child.cpp View File

getErrorText()); getErrorText());
} }
// Provide the stream buffers with the handles for communicating
// with the child process.
// Save the handles for communicating with the child process.
inputHandle = childStdOutAtParent; inputHandle = childStdOutAtParent;
outputHandle = childStdInAtParent; outputHandle = childStdInAtParent;
exit(-1); exit(-1);
} }
if (dup2(childStdOutPipe[1], STDERR_FILENO) == -1) {
std::string errMsg;
// Send message to parent.
errMsg = "Error redirecting stderr in the child: " + getErrorText();
::write(childStdOutPipe[1], errMsg.data(), errMsg.size());
exit(-1);
}
// Close pipes. // Close pipes.
if ( (::close(childStdInPipe[0]) != 0) || if ( (::close(childStdInPipe[0]) != 0) ||
(::close(childStdInPipe[1]) != 0) || (::close(childStdInPipe[1]) != 0) ||

Loading…
Cancel
Save