function ComposerRunner::run
File
-
core/
modules/ package_manager/ src/ ComposerRunner.php, line 39
Class
- ComposerRunner
- Runs Composer through the current PHP interpreter.
Namespace
Drupal\package_managerCode
public function run(array $command, ?PathInterface $cwd = NULL, array $env = [], ?OutputCallbackInterface $callback = NULL, int $timeout = ProcessInterface::DEFAULT_TIMEOUT) : void {
// Run Composer through the PHP interpreter so we don't have to rely on
// PHP being in the PATH.
array_unshift($command, (new PhpExecutableFinder())->find(), $this->executableFinder
->find('composer'));
$home = $this->fileSystem
->getTempDirectory();
$home .= '/package_manager_composer_home-';
$home .= $this->configFactory
->get('system.site')
->get('uuid');
$this->fileSystem
->prepareDirectory($home, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS);
$process = $this->processFactory
->create($command, $cwd, $env + [
'COMPOSER_HOME' => $home,
]);
$process->setTimeout($timeout);
$process->mustRun($callback);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.