Skip to content

Commit

Permalink
Merge pull request #43 from creative-commoners/pulls/1.0/thats-not-my…
Browse files Browse the repository at this point in the history
…-home-either

FIX Don't blindly assume that HOME is writable
  • Loading branch information
ScopeyNZ authored Nov 7, 2018
2 parents 0618b7a + a2a3ad5 commit 9e05e30
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 9e05e30

Please sign in to comment.