|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
#else
|
|
|
#else
|
|
|
|
|
|
fd_set readFd;
|
|
|
|
|
|
int retVal;
|
|
|
|
|
|
struct timeval timeout = {0, 0};
|
|
|
|
|
|
|
|
|
|
|
|
FD_ZERO(&readFd);
|
|
|
|
|
|
FD_SET(inputFileDescriptor, &readFd);
|
|
|
|
|
|
|
|
|
|
|
|
// Check if input is available.
|
|
|
|
|
|
retVal = select(inputFileDescriptor + 1, &readFd, NULL, NULL, &timeout);
|
|
|
|
|
|
|
|
|
|
|
|
if (-1 == retVal) {
|
|
|
|
|
|
throw std::runtime_error("Error from select() when reading from the "
|
|
|
|
|
|
"child process: " + getErrorText());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Is data available?
|
|
|
|
|
|
if (0 == retVal) {
|
|
|
|
|
|
|
|
|
|
|
|
// No. Wait and try again.
|
|
|
|
|
|
pollTimer.pause();
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
ssize_t nBytesRead;
|
|
|
ssize_t nBytesRead;
|
|
|
|
|
|
|
|
|
nBytesRead = ::read(inputFileDescriptor,
|
|
|
nBytesRead = ::read(inputFileDescriptor,
|