瀏覽代碼

Point users at troubleshooting if they get known exceptions

Jordi Boggiano 10 年之前
父節點
當前提交
aec1af4e11
共有 1 個文件被更改,包括 10 次插入0 次删除
  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);
     }