Explorar o código

Point users at troubleshooting if they get known exceptions

Jordi Boggiano %!s(int64=11) %!d(string=hai) anos
pai
achega
aec1af4e11
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  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);
     }