/** * Reads pipes, executes callback. * * @param Boolean $blocking Whether to use blocking calls or not. */ private function readPipes($blocking, $close) { if ($close) { $result = $this->processPipes->readAndCloseHandles($blocking); } else { $result = $this->processPipes->read($blocking); } foreach ($result as $type => $data) { if (3 == $type) { $this->fallbackExitcode = (int) $data; } else { call_user_func($this->callback, $type === self::STDOUT ? self::OUT : self::ERR, $data); } } }
/** * Reads pipes, executes callback. * * @param bool $blocking Whether to use blocking calls or not. * @param bool $close Whether to close file handles or not. */ private function readPipes($blocking, $close) { if ($close) { $result = $this->processPipes->readAndCloseHandles($blocking); } else { $result = $this->processPipes->read($blocking); } $callback = $this->callback; foreach ($result as $type => $data) { if (3 !== $type) { $callback($type === self::STDOUT ? self::OUT : self::ERR, $data); } elseif (!isset($this->fallbackStatus['signaled'])) { $this->fallbackStatus['exitcode'] = (int) $data; } } }