Explorar o código

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

Jordi Boggiano %!s(int64=12) %!d(string=hai) anos
pai
achega
83ea90296e
Modificáronse 2 ficheiros con 9 adicións e 0 borrados
  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
 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).
 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) →
 ← [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')) {
         if ($input->hasParameterOption('--profile')) {
             $startTime = microtime(true);
             $startTime = microtime(true);
             $this->io->enableDebugging($startTime);
             $this->io->enableDebugging($startTime);