Merge pull request #6956 from wsandin/master
Fix for issue 6602 - warning when running composer as another userpull/7040/head
commit
0161a63a0a
|
@ -107,6 +107,15 @@ EOT
|
|||
throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
|
||||
}
|
||||
|
||||
// check if composer is running as the same user that owns the directory root, only if POSIX is defined and callable
|
||||
if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
|
||||
$composeUser = posix_getpwuid(posix_geteuid());
|
||||
$homeOwner = posix_getpwuid(fileowner($home));
|
||||
if ($composeUser !== $homeOwner) {
|
||||
$io->writeError('<warning>You are running composer as "'.$composeUser.'", while "'.$home.'" is owned by "'.$homeOwner.'"</warning>');
|
||||
}
|
||||
}
|
||||
|
||||
if ($input->getOption('rollback')) {
|
||||
return $this->rollback($output, $rollbackDir, $localFilename);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue