diff --git a/src/Composer/Command/InstallCommand.php b/src/Composer/Command/InstallCommand.php
index 7bf90709e..cee9a9603 100644
--- a/src/Composer/Command/InstallCommand.php
+++ b/src/Composer/Command/InstallCommand.php
@@ -61,6 +61,6 @@ EOT
->setInstallSuggests($input->getOption('install-suggests'))
;
- return $install->run();
+ return $install->run() ? 0 : 1;
}
}
diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php
index dad3dc08e..34e01fee6 100644
--- a/src/Composer/Installer.php
+++ b/src/Composer/Installer.php
@@ -18,6 +18,7 @@ use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\Request;
use Composer\DependencyResolver\Solver;
+use Composer\DependencyResolver\SolverProblemsException;
use Composer\Downloader\DownloadManager;
use Composer\Installer\InstallationManager;
use Composer\IO\IOInterface;
@@ -163,7 +164,7 @@ class Installer
$installFromLock = false;
$request = new Request($pool);
if ($this->update) {
- $this->io->write('Updating dependencies');
+ $this->io->write('Updating dependencies');
$request->updateAll();
@@ -174,7 +175,7 @@ class Installer
}
} elseif ($this->locker->isLocked()) {
$installFromLock = true;
- $this->io->write('Installing from lock file');
+ $this->io->write('Installing from lock file');
if (!$this->locker->isFresh()) {
$this->io->write('Your lock file is out of sync with your composer.json, run "composer.phar update" to update dependencies');
@@ -192,7 +193,7 @@ class Installer
$request->install($package->getName(), $constraint);
}
} else {
- $this->io->write('Installing dependencies');
+ $this->io->write('Installing dependencies');
$links = $this->collectLinks();
@@ -206,7 +207,14 @@ class Installer
$solver = new Solver($policy, $pool, $installedRepo);
// solve dependencies
- $operations = $solver->solve($request);
+ try {
+ $operations = $solver->solve($request);
+ } catch (SolverProblemsException $e) {
+ $this->io->write('Your requirements could not be solved to an installable set of packages.');
+ $this->io->write($e->getMessage());
+
+ return false;
+ }
// force dev packages to be updated to latest reference on update
if ($this->update) {
@@ -299,6 +307,8 @@ class Installer
$eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
$this->eventDispatcher->dispatchCommandEvent($eventName);
}
+
+ return true;
}
private function collectLinks()