Browse Source

Make phar build fails more debuggable

Jordi Boggiano 12 years ago
parent
commit
cfc8bf0730
2 changed files with 10 additions and 3 deletions
  1. 7 2
      bin/compile
  2. 3 1
      tests/Composer/Test/AllFunctionalTest.php

+ 7 - 2
bin/compile

@@ -8,5 +8,10 @@ use Composer\Compiler;
 error_reporting(-1);
 ini_set('display_errors', 1);
 
-$compiler = new Compiler();
-$compiler->compile();
+try {
+    $compiler = new Compiler();
+    $compiler->compile();
+} catch (\Exception $e) {
+    echo 'Failed to compile phar: ['.get_class($e).'] '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine();
+    exit(1);
+}

+ 3 - 1
tests/Composer/Test/AllFunctionalTest.php

@@ -58,7 +58,9 @@ class AllFunctionalTest extends \PHPUnit_Framework_TestCase
         $proc = new Process('php '.escapeshellarg(__DIR__.'/../../../bin/compile'));
         $exitcode = $proc->run();
 
-        $this->assertSame(0, $exitcode);
+        if ($exitcode !== 0 || trim($proc->getOutput())) {
+            $this->fail($proc->getOutput());
+        }
         $this->assertTrue(file_exists(self::$pharPath));
     }