Disables fetching output and error output from the underlying process.

@return $this

@throws RuntimeException In case the process is already running
@throws LogicException   if an idle timeout is set
329298
public function disableOutput()
    {
        if ($this->isRunning()) {
            throw new RuntimeException('Disabling output while the process is running is not possible.');
        }
        if (null !== $this->idleTimeout) {
            throw new LogicException('Output can not be disabled while an idle timeout is set.');
        }

        $this->outputDisabled = true;

        return $this;
    }
971049
private function readPipesForOutput($caller, $blocking = false)
    {
        if ($this->outputDisabled) {
            throw new LogicException('Output has been disabled.');
        }

        $this->requireProcessIsStarted($caller);

        $this->updateStatus($blocking);
    }
1212270
public function getInput()
    {
        $this->codeBufferOpen = false;

        do {
            // reset output verbosity (in case it was altered by a subcommand)
            $this->output->setVerbosity(ShellOutput::VERBOSITY_VERBOSE);

            $input = $this->readline();

            /*
             * Handle Ctrl+D. It behaves differently in different cases:
             *
             *   1) In an expression, like a function or "if" block, clear the input buffer
             *   2) At top-level session, behave like the exit command
             */
            if ($input === false) {
                $this->output->writeln('');

                if ($this->hasCode()) {
                    $this->resetCodeBuffer();
                } else {
                    throw new BreakException('Ctrl+D');
                }
            }

            // handle empty input
            if (\trim($input) === '' && !$this->codeBufferOpen) {
                continue;
            }

            $input = $this->onInput($input);

            // If the input isn't in an open string or comment, check for commands to run.
            if ($this->hasCommand($input) && !$this->inputInOpenStringOrComment($input)) {
                $this->addHistory($input);
                $this->runCommand($input);

                continue;
            }

            $this->addCode($input);
        } while (!$this->hasValidCode());
    }
4235
public function stop()
    {
        if (is_null($this->sectionName)) {
            throw new LogicException(
                'You must start a section before you can stop it.'
            );
        }

        $content = ob_get_clean();

        if ($this->appendSection && isset($this->sections[$this->sectionName])) {
            $this->sections[$this->sectionName] = $this->sections[$this->sectionName] .ob_get_clean();
        } elseif ($this->prependSection && isset($this->sections[$this->sectionName])) {
            $this->sections[$this->sectionName] = ob_get_clean() . $this->sections[$this->sectionName];
        } else {
            $this->sections[$this->sectionName] = $content;
        }

        $this->sectionName = null;
        $this->appendSection  = false;
        $this->prependSection = false;
    }
1326529
protected function cleanup()
    {
        if ($this->running) {
            throw new RuntimeException(sprintf('Cleanup error - process still running: %s', is_scalar($this->command) ? $this->command : $this->command->serialize()));
        }

        if (!isset($this->resource)) {
            return;
        }

        $this->pid = -1;
        $this->read();

        foreach ($this->pipes as $index => $pipe) {
            if (!$this->interactive && $index === static::STDIN) {
                continue;
            }

            fclose($pipe);
        }

        proc_close($this->resource);
        unset($this->resource, $this->pipes);

        $this->running = false;

        if (in_array($this->exitcode, $this->getExpectedExitcodes())) {
            if (isset($this->onSuccess)) {
                call_user_func($this->onSuccess);
            }
        } else {
            if (isset($this->onError)) {
                call_user_func($this->onError, $this);
            } else {
                throw new ProcessException(sprintf('Error executing process: %s', is_scalar($this->command) ? $this->command : $this->command->serialize()), $this);
            }
        }
    }
389617
protected function getStdIn()
    {
        if ($this->stdIn && !feof($this->stdIn)) {
            return $this->stdIn;
        }

        try {
            $this->setStdIn();
        } catch (\Error $e) {
            throw new RuntimeException('Unable to read from STDIN', 0, $e);
        }

        return $this->stdIn;
    }
348552
public function eof()
	{
		if (!$this->fh)
		{
			throw new \RuntimeException('File not open');
		}

		// Capture PHP errors
		$php_errormsg = '';
		$track_errors = ini_get('track_errors');
		ini_set('track_errors', true);

		switch ($this->processingmethod)
		{
			case 'gz':
				$res = gzeof($this->fh);
				break;

			case 'bz':
			case 'f':
			default:
				$res = feof($this->fh);
				break;
		}

		if ($php_errormsg)
		{
			throw new \RuntimeException($php_errormsg);
		}

		// Restore error tracking to what it was before
		ini_set('track_errors', $track_errors);

		// Return the result
		return $res;
	}
711944
protected function _process()
    {
        if ($this->__isProcessed === true) {
            return $this;
        }

        $limit = $this->getLimit();
        if (is_null($limit)) {
            $this->setPagesNumber(1);
            $this->setOffset(0);
        } else {
            $this->setPagesNumber(round($this->getItemsNumber() / $this->getLimit()));
        }

        $this->__isProcessed = true;
        return $this;
    }
474744
public function clearOutput()
    {
        ftruncate($this->stdout, 0);
        fseek($this->stdout, 0);
        $this->incrementalOutputOffset = 0;

        return $this;
    }
489531
public static function clear() {
        try {
            self::getCache()->clear();
            self::release();
        } catch (\RuntimeException $e) {
            self::release();
            throw $e;
        } catch (\Error $e) {
            self::release();
            throw $e;
        }
    }
536277
public static function clearOutput(): void
  {
    // Return immediately if skipClearOutput is set.
    if (self::$skipClearOutput) return;

    $level = ob_get_level();

    // The following manual level counting is to deal with zlib.output_compression set to On.
    for ($i = $level; $i>0; --$i)
    {
      if (!@ob_end_clean())
      {
        ob_clean();
      }
    }

    if ($level>0)
    {
      // Restart output buffer in order to allow modification of headers.
      ob_start();
    }
  }
64741
public function parse()
	{
		if ($this->input === null)
		{
			throw new LogicException('You must specify an IOInterface for input first.');
		}

		return $this->parser->parse(
			$this->input->getContent()
		);
	}
1071465
public function useGlobally()
    {
        if (!isset($this->handle)) {
            throw new \RuntimeException("The stream is closed");
        }
        
        if ($this->isGlobal()) {
            return $this;
        }
        
        $this->assertOutputBuffering();
        
        $output = $this->createOutputStream();
        if ($output === false) {
            throw new \RuntimeException("Failed to create temp stream");
        }
        
        $this->obClean();
        $this->rewind();
        stream_copy_to_stream($this->handle, $output);
        
        parent::close();
        $this->handle = $output;
        
        return $this;
    }
653941
public function afterExecuteRoute() {
        /** @var \Bullhorn\FastRest\Api\Services\Output\OutputInterface $output */
        $output = $this->getDI()->get(OutputInterface::DI_NAME);
        if(!($output instanceof OutputInterface)) {
            throw new \Exception('The Output must implement: ' . OutputInterface::class);
        }
        $object = $this->getOutputObject();
        $errors = $this->getErrors();
        $code = $this->getStatusCode();

        $object = $this->addErrorsAndStatus($errors, $code, $object);
        $this->response->setStatusCode($object->statusCode, 'Check Document Body For More Details');
        $output->output($object, $this->response);
        $this->view->disable();
    }
1193376
public function beforeCompile()
	{
		$builder = $this->getContainerBuilder();

		if (!$builder->getByType(Application::class)) {
			throw new LogicException(sprintf('Service of type "%s" is needed. Please register it.', Application::class));
		}

		if (!$builder->getByType(EventDispatcher::class)) {
			throw new LogicException(sprintf('Service of type "%s" is needed. Please register it.', EventDispatcher::class));
		}

		$application = $builder->getDefinition($builder->getByType(Application::class));
		$dispatcher = $builder->getDefinition($builder->getByType(EventDispatcher::class));

		$application->addSetup('?->onStartup[] = function() {?->dispatch(?, new ?(...func_get_args()));}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_STARTUP,
			new PhpLiteral(StartupEvent::class),
		]);
		$application->addSetup('?->onError[] = function() {?->dispatch(?, new ?(...func_get_args()));}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_ERROR,
			new PhpLiteral(ErrorEvent::class),
		]);
		$application->addSetup('?->onPresenter[] = function() {?->dispatch(?, new ?(...func_get_args()));}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_PRESENTER,
			new PhpLiteral(PresenterEvent::class),
		]);
		$application->addSetup('?->onRequest[] = function() {?->dispatch(?, new ?(...func_get_args()));}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_REQUEST,
			new PhpLiteral(RequestEvent::class),
		]);
		$application->addSetup('?->onResponse[] = function() {?->dispatch(?, new ?(...func_get_args()));}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_RESPONSE,
			new PhpLiteral(ResponseEvent::class),
		]);
		$application->addSetup('?->onShutdown[] = function() {?->dispatch(?, new ?(...func_get_args()));}', [
			'@self',
			$dispatcher,
			ApplicationEvents::ON_SHUTDOWN,
			new PhpLiteral(ShutdownEvent::class),
		]);
	}
827152
public function begin() {
        if ($this->transactionLevel < 0) throw new RuntimeException('Negative transaction nesting level detected: '.$this->transactionLevel);

        if (!$this->transactionLevel)
            $this->execute('start transaction');

        $this->transactionLevel++;
        return $this;
    }
1371523
protected function exceptionIfFetchedAlready()
    {
        if ($this->fetched) {
            throw new RuntimeException(
                Message::get(Message::DB_RESULT_FETCHED),
                Message::DB_RESULT_FETCHED
            );
        }
    }