Browse Source

Point users at troubleshooting if they get known exceptions

Jordi Boggiano 10 years ago
parent
commit
aec1af4e11
1 changed files with 10 additions and 0 deletions
  1. 10 0
      src/Composer/Console/Application.php

+ 10 - 0
src/Composer/Console/Application.php

@@ -191,6 +191,16 @@ class Application extends BaseApplication
         } catch (\Exception $e) {
         }
 
+        if (defined('PHP_WINDOWS_VERSION_BUILD') && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
+            $output->writeln('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>');
+            $output->writeln('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- for details</error>');
+        }
+
+        if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
+            $output->writeln('<error>The following exception is caused by a lack of memory and not having swap configured</error>');
+            $output->writeln('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>');
+        }
+
         return parent::renderException($exception, $output);
     }