瀏覽代碼

Add COMPOSER_NO_INTERACTION env var to allow travis & others to easily make sure every composer run is non-interactive

Jordi Boggiano 12 年之前
父節點
當前提交
83ea90296e
共有 2 個文件被更改,包括 9 次插入0 次删除
  1. 5 0
      doc/03-cli.md
  2. 4 0
      src/Composer/Console/Application.php

+ 5 - 0
doc/03-cli.md

@@ -423,4 +423,9 @@ configuration in the project's `composer.json` always wins.
 This env var controls the time composer waits for commands (such as git
 commands) to finish executing. The default value is 300 seconds (5 minutes).
 
+### COMPOSER_NO_INTERACTION
+
+If set to 1, this env var will make composer behave as if you passed the
+`--no-interaction` flag to every command. This can be set on build boxes/CI.
+
 ← [Libraries](02-libraries.md)  |  [Schema](04-schema.md) →

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

@@ -100,6 +100,10 @@ class Application extends BaseApplication
             }
         }
 
+        if (getenv('COMPOSER_NO_INTERACTION')) {
+            $input->setInteractive(false);
+        }
+
         if ($input->hasParameterOption('--profile')) {
             $startTime = microtime(true);
             $this->io->enableDebugging($startTime);