Browse Source

Merge pull request #8462 from BR0kEN-/issues/8461

#8461: [ZipDownloader] Print `unzip` exit code when the command is failed
Jordi Boggiano 5 years ago
parent
commit
295cc8bc90

+ 2 - 2
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;
         }

+ 2 - 2
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()
     {