private function Process::processFileHandles

Handles the windows file handles fallbacks.

Parameters

callable $callback A valid PHP callback:

Boolean $closeEmptyHandles if true, handles that are empty will be assumed closed:

2 calls to Process::processFileHandles()
Process::start in drupal/core/vendor/symfony/process/Symfony/Component/Process/Process.php
Starts the process and returns after sending the STDIN.
Process::wait in drupal/core/vendor/symfony/process/Symfony/Component/Process/Process.php
Waits for the process to terminate.

File

drupal/core/vendor/symfony/process/Symfony/Component/Process/Process.php, line 1217

Class

Process
Process is a thin wrapper around proc_* functions to ease start independent PHP processes.

Namespace

Symfony\Component\Process

Code

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]);
    }
  }
}