|
|
|
|
|
|
|
|
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) ||
|