Skip to content

Commit

Permalink
FIX Don't blindly assume that HOME is writable
Browse files Browse the repository at this point in the history
  • Loading branch information
ScopeyNZ committed Sep 13, 2018
1 parent 0618b7a commit a2a3ad5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Extensions/ComposerLoaderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ protected function getInstalledConstraint(BaseRepository $repository, $packageNa
public function onAfterBuild()
{
// Mock COMPOSER_HOME if it's not defined already. Composer requires one of the two to be set.
if (!getenv('HOME') && !getenv('COMPOSER_HOME')) {
putenv('COMPOSER_HOME=/tmp');
if (!getenv('COMPOSER_HOME')) {
$home = getenv('HOME');
if (!$home || !is_dir($home) || !is_writable($home)) {
// Set our own directory
putenv('COMPOSER_HOME=' . sys_get_temp_dir());
}
}

$originalDir = getcwd();
Expand Down

0 comments on commit a2a3ad5

Please sign in to comment.