From bb127aa3e7fe6124a8c1f75116a5c2d110a0e7b1 Mon Sep 17 00:00:00 2001 From: Sergii Bondarenko Date: Tue, 3 Dec 2019 15:30:08 +0400 Subject: [PATCH] Resolves #8461: [ZipDownloader] Print `unzip` exit code when the command is failed --- src/Composer/Downloader/ZipDownloader.php | 4 ++-- tests/Composer/Test/Downloader/ZipDownloaderTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Composer/Downloader/ZipDownloader.php b/src/Composer/Downloader/ZipDownloader.php index 6534db3d8..8aca21e59 100644 --- a/src/Composer/Downloader/ZipDownloader.php +++ b/src/Composer/Downloader/ZipDownloader.php @@ -105,11 +105,11 @@ class ZipDownloader extends ArchiveDownloader $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path); try { - if (0 === $this->process->execute($command, $ignoredOutput)) { + if (0 === $exitCode = $this->process->execute($command, $ignoredOutput)) { return true; } - $processError = new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()); + $processError = new \RuntimeException('Failed to execute ('.$exitCode.') '.$command."\n\n".$this->process->getErrorOutput()); } catch (\Exception $e) { $processError = $e; } diff --git a/tests/Composer/Test/Downloader/ZipDownloaderTest.php b/tests/Composer/Test/Downloader/ZipDownloaderTest.php index 239ec9221..4ff3f055c 100644 --- a/tests/Composer/Test/Downloader/ZipDownloaderTest.php +++ b/tests/Composer/Test/Downloader/ZipDownloaderTest.php @@ -184,7 +184,7 @@ class ZipDownloaderTest extends TestCase /** * @expectedException \Exception - * @expectedExceptionMessage Failed to execute unzip + * @expectedExceptionMessage Failed to execute (1) unzip */ public function testSystemUnzipOnlyFailed() { @@ -310,7 +310,7 @@ class ZipDownloaderTest extends TestCase /** * @expectedException \Exception - * @expectedExceptionMessage Failed to execute unzip + * @expectedExceptionMessage Failed to execute (1) unzip */ public function testWindowsFallbackFailed() {