Merge remote-tracking branch 'mizunashi-mana/fix-issue-5045'
commit
2f6b4c439d
|
@ -145,13 +145,18 @@ class EventDispatcher
|
||||||
*/
|
*/
|
||||||
protected function doDispatch(Event $event)
|
protected function doDispatch(Event $event)
|
||||||
{
|
{
|
||||||
|
$pathStr = 'PATH';
|
||||||
|
if (!isset($_SERVER[$pathStr])) {
|
||||||
|
$pathStr = 'Path';
|
||||||
|
}
|
||||||
|
|
||||||
// add the bin dir to the PATH to make local binaries of deps usable in scripts
|
// add the bin dir to the PATH to make local binaries of deps usable in scripts
|
||||||
$binDir = $this->composer->getConfig()->get('bin-dir');
|
$binDir = $this->composer->getConfig()->get('bin-dir');
|
||||||
if (is_dir($binDir)) {
|
if (is_dir($binDir)) {
|
||||||
$binDir = realpath($binDir);
|
$binDir = realpath($binDir);
|
||||||
if (isset($_SERVER['PATH']) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER['PATH'])) {
|
if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
|
||||||
$_SERVER['PATH'] = $binDir.PATH_SEPARATOR.getenv('PATH');
|
$_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
|
||||||
putenv('PATH='.$_SERVER['PATH']);
|
putenv($pathStr.'='.$_SERVER[$pathStr]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue