/** * Run the process. * * @param array $arguments The additional arguments to add to the call. * * @return Process */ public function spawn($arguments) { $cmd = sprintf('%s %s', escapeshellcmd($this->config->getPhpCliBinary()), $this->getArguments($arguments)); if ($this->config->isForceToBackgroundEnabled()) { $cmd .= '&'; } return new Process($cmd, $this->homePath, $this->getEnvironment(), null, null); }
/** * Build the internal process builder. * * @param array $arguments The arguments. * * @return ProcessBuilder */ private function buildInternal(array $arguments) { $builder = ProcessBuilder::create($this->config->getPhpCliBinary()); if (null !== ($cliArguments = $this->config->getPhpCliArguments())) { $builder->addArguments($cliArguments); } $builder->addArguments($arguments); if (null !== ($environment = $this->config->getPhpCliEnvironment())) { foreach ($environment as $name => $value) { $builder->setEnv($name, $value); } } // MUST be kept last. $builder->setEnv('COMPOSER', $this->homePath . DIRECTORY_SEPARATOR . 'composer.json'); return $builder; }