You are here

public function ProcessBuilder::getProcess in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/process/ProcessBuilder.php \Symfony\Component\Process\ProcessBuilder::getProcess()

Creates a Process instance and returns it.

Return value

Process

Throws

LogicException In case no arguments have been provided

File

vendor/symfony/process/ProcessBuilder.php, line 261

Class

ProcessBuilder
Process builder.

Namespace

Symfony\Component\Process

Code

public function getProcess() {
  if (0 === count($this->prefix) && 0 === count($this->arguments)) {
    throw new LogicException('You must add() command arguments before calling getProcess().');
  }
  $options = $this->options;
  $arguments = array_merge($this->prefix, $this->arguments);
  $script = implode(' ', array_map(array(
    __NAMESPACE__ . '\\ProcessUtils',
    'escapeArgument',
  ), $arguments));
  if ($this->inheritEnv) {

    // include $_ENV for BC purposes
    $env = array_replace($_ENV, $_SERVER, $this->env);
  }
  else {
    $env = $this->env;
  }
  $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  if ($this->outputDisabled) {
    $process
      ->disableOutput();
  }
  return $process;
}