Browse Source

Fail hard when failing to download using hg

Jordi Boggiano 13 years ago
parent
commit
5be7f4cf09
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/Composer/Downloader/HgDownloader.php

+ 8 - 2
src/Composer/Downloader/HgDownloader.php

@@ -29,7 +29,10 @@ class HgDownloader extends VcsDownloader
         $ref = escapeshellarg($package->getSourceReference());
         $path = escapeshellarg($path);
         $this->io->write("    Cloning ".$package->getSourceReference());
-        $this->process->execute(sprintf('hg clone %s %s && cd %2$s && hg up %s', $url, $path, $ref), $ignoredOutput);
+        $command = sprintf('hg clone %s %s && cd %2$s && hg up %s', $url, $path, $ref);
+        if (0 !== $this->process->execute($command, $ignoredOutput)) {
+            throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
+        }
     }
 
     /**
@@ -41,7 +44,10 @@ class HgDownloader extends VcsDownloader
         $ref = escapeshellarg($target->getSourceReference());
         $path = escapeshellarg($path);
         $this->io->write("    Updating to ".$target->getSourceReference());
-        $this->process->execute(sprintf('cd %s && hg pull %s && hg up %s', $path, $url, $ref), $ignoredOutput);
+        $command = sprintf('cd %s && hg pull %s && hg up %s', $path, $url, $ref);
+        if (0 !== $this->process->execute($command, $ignoredOutput)) {
+            throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
+        }
     }
 
     /**