You are here

public function ProcessHelper::mustRun in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Helper/ProcessHelper.php \Symfony\Component\Console\Helper\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

OutputInterface $output An OutputInterface instance:

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

string|null $error An error message that must be displayed if something went wrong:

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

Return value

Process The process that ran

Throws

ProcessFailedException

See also

run()

File

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

Class

ProcessHelper
The ProcessHelper class provides helpers to run external processes.

Namespace

Symfony\Component\Console\Helper

Code

public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null) {
  $process = $this
    ->run($output, $cmd, $error, $callback);
  if (!$process
    ->isSuccessful()) {
    throw new ProcessFailedException($process);
  }
  return $process;
}