Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ProcessHelper.php

function ProcessHelper::mustRun

Runs the process.

This is identical to run() except that an exception is thrown if the process exits with a non-zero exit code.

Parameters

array|Process $cmd An instance of Process or a command to run:

callable|null $callback A PHP callback to run whenever there is some: output available on STDOUT or STDERR

Throws

ProcessFailedException

See also

run()

File

vendor/symfony/console/Helper/ProcessHelper.php, line 97

Class

ProcessHelper
The ProcessHelper class provides helpers to run external processes.

Namespace

Symfony\Component\Console\Helper

Code

public function mustRun(OutputInterface $output, array|Process $cmd, ?string $error = null, ?callable $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE) : Process {
    $process = $this->run($output, $cmd, $error, $callback, $verbosity);
    if (!$process->isSuccessful()) {
        throw new ProcessFailedException($process);
    }
    return $process;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal