1
0
Fork 0

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

pull/6099/head
Jordi Boggiano 2017-01-22 18:26:49 +01:00
parent 0ea93df252
commit e4840ee413
2 changed files with 3 additions and 1 deletions

View File

@ -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);

View File

@ -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()));