Handles the windows file handles fallbacks.
callable $callback A valid PHP callback:
Boolean $closeEmptyHandles if true, handles that are empty will be assumed closed:
private function processFileHandles($callback, $closeEmptyHandles = false) {
$fh = $this->fileHandles;
foreach ($fh as $type => $fileHandle) {
fseek($fileHandle, $this->readBytes[$type]);
$data = fread($fileHandle, 8192);
if (strlen($data) > 0) {
$this->readBytes[$type] += strlen($data);
call_user_func($callback, $type == 1 ? self::OUT : self::ERR, $data);
}
if (false === $data || $closeEmptyHandles && '' === $data && feof($fileHandle)) {
fclose($fileHandle);
unset($this->fileHandles[$type]);
}
}
}