Add a COMPOSER_BINARY env var so that chdir does not affect @composer script resolvability, fixes #6080

main
Jordi Boggiano 7 years ago
parent 0ea93df252
commit e4840ee413

@ -48,6 +48,8 @@ if (function_exists('ini_set')) {
unset($memoryInBytes, $memoryLimit);
}
putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
// run the command application
$application = new Application();
$application->run(null, $output);

@ -180,7 +180,7 @@ class EventDispatcher
if (!$phpPath) {
throw new \RuntimeException('Failed to locate PHP binary to execute '.$scriptName);
}
$exec = $phpPath . ' ' . realpath($_SERVER['argv'][0]) . substr($callable, 9);
$exec = ProcessExecutor::escape($phpPath) . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
if (0 !== ($exitCode = $this->process->execute($exec))) {
$this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()));

Loading…
Cancel
Save