You are here

public function ProcessFactory::create in Automatic Updates 8.2

File

package_manager/src/ProcessFactory.php, line 72

Class

ProcessFactory
Defines a process factory which sets the COMPOSER_HOME environment variable.

Namespace

Drupal\package_manager

Code

public function create(array $command) : Process {
  $process = $this->decorated
    ->create($command);
  $env = $process
    ->getEnv();
  if ($this
    ->isComposerCommand($command)) {
    $env['COMPOSER_HOME'] = $this
      ->getComposerHomePath();
  }

  // Ensure that the running PHP binary is in the PATH.
  $env['PATH'] = $this
    ->getEnv('PATH') . ':' . dirname(PHP_BINARY);
  return $process
    ->setEnv($env);
}