Skip to content

Commit 057e963

Browse files
Merge branch '4.4' into 5.1
* 4.4: [HttpKernel] Configure the ErrorHandler even when it is overriden Allow relative path to composer cache
2 parents cb0094a + 85a2fcd commit 057e963

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

bin/simple-phpunit.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,18 @@
158158
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
159159
: 'composer';
160160

161+
$prevCacheDir = getenv('COMPOSER_CACHE_DIR');
162+
if ($prevCacheDir) {
163+
if (false === $absoluteCacheDir = realpath($prevCacheDir)) {
164+
@mkdir($prevCacheDir, 0777, true);
165+
$absoluteCacheDir = realpath($prevCacheDir);
166+
}
167+
if ($absoluteCacheDir) {
168+
putenv("COMPOSER_CACHE_DIR=$absoluteCacheDir");
169+
} else {
170+
$prevCacheDir = false;
171+
}
172+
}
161173
$SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy'.($PHPUNIT_VERSION < 6.0 ? ' symfony/yaml' : ''));
162174
$configurationHash = md5(implode(\PHP_EOL, [md5_file(__FILE__), $SYMFONY_PHPUNIT_REMOVE, (int) $PHPUNIT_REMOVE_RETURN_TYPEHINT]));
163175
$PHPUNIT_VERSION_DIR = sprintf('phpunit-%s-%d', $PHPUNIT_VERSION, $PHPUNIT_REMOVE_RETURN_TYPEHINT);
@@ -240,6 +252,9 @@
240252
// --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
241253
$exit = proc_close(proc_open("$q$COMPOSER install --no-dev --prefer-dist --no-progress $q", [], $p, getcwd()));
242254
putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
255+
if ($prevCacheDir) {
256+
putenv("COMPOSER_CACHE_DIR=$prevCacheDir");
257+
}
243258
if ($exit) {
244259
exit($exit);
245260
}

0 commit comments

Comments
 (0)