You are here

public function Process::mustRun in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/process/Process.php \Symfony\Component\Process\Process::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

callable|null $callback:

Return value

self

Throws

RuntimeException if PHP was compiled with --enable-sigchild and the enhanced sigchild compatibility mode is not enabled

ProcessFailedException if the process didn't terminate successfully

File

vendor/symfony/process/Process.php, line 220

Class

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

Namespace

Symfony\Component\Process

Code

public function mustRun($callback = null) {
  if ($this
    ->isSigchildEnabled() && !$this->enhanceSigchildCompatibility) {
    throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  }
  if (0 !== $this
    ->run($callback)) {
    throw new ProcessFailedException($this);
  }
  return $this;
}