1
0
Fork 0

Merge pull request #7897 from glaubinix/f/cleanup-tmp-dir

Archive: cleanup temp dir on download error
pull/7925/head
Jordi Boggiano 2019-01-28 10:34:26 +01:00 committed by GitHub
commit d2085936fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -147,8 +147,13 @@ class ArchiveManager
$sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
$filesystem->ensureDirectoryExists($sourcePath);
// Download sources
$this->downloadManager->download($package, $sourcePath);
try {
// Download sources
$this->downloadManager->download($package, $sourcePath);
} catch (\Exception $e) {
$filesystem->removeDirectory($sourcePath);
throw $e;
}
// Check exclude from downloaded composer.json
if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {