public function PhpProcess::start

Starts the process and returns after sending the STDIN.

This method blocks until all STDIN data is sent to the process then it returns while the process runs in the background.

The termination of the process can be awaited with wait().

The callback receives the type of output (out or err) and some bytes from the output in real-time while writing the standard input to the process. It allows to have feedback from the independent process during execution. If there is no callback passed, the wait() method can be called with true as a second parameter then the callback will get all data occurred in (and since) the start call.

Parameters

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

Throws

RuntimeException When process can't be launch or is stopped

RuntimeException When process is already running

Overrides Process::start

File

drupal/core/vendor/symfony/process/Symfony/Component/Process/PhpProcess.php, line 62

Class

PhpProcess
PhpProcess runs a PHP script in an independent process.

Namespace

Symfony\Component\Process

Code

public function start($callback = null) {
  if (null === $this
    ->getCommandLine()) {
    if (false === ($php = $this->executableFinder
      ->find())) {
      throw new RuntimeException('Unable to find the PHP executable.');
    }
    $this
      ->setCommandLine($php);
  }
  parent::start($callback);
}