Browse Source

Document the alternatives to disable the default script timeout

Mentioning and giving an example of the usage of the 4 options to disable the default script timeout of 300 seconds:
1. Static helper (already exists and kept).
2. Config key "process-timeout".
3. Environment variable "COMPOSER_PROCESS_TIMEOUT".
4. The "--timeout" parameter.
Guilherme Rossato 6 years ago
parent
commit
ce8afe1c95
1 changed files with 31 additions and 4 deletions
  1. 31 4
      doc/articles/scripts.md

+ 31 - 4
doc/articles/scripts.md

@@ -224,11 +224,13 @@ to the `phpunit` script.
 Although Composer is not intended to manage long-running processes and other
 such aspects of PHP projects, it can sometimes be handy to disable the process
 timeout on custom commands. This timeout defaults to 300 seconds and can be
-overridden for all commands using the config key `process-timeout`, or for
-specific commands using an argument to the `run-script` command.
+overridden in a variety of ways depending on the desired effect: it's possible
+to disable it for all command using the config key `process-timeout`, or for
+a specific call using the `--timeout` parameter of the `run` (`run-scripts`)
+command, or using a static helper for specific scripts.
 
-A static helper also exists that can disable the process timeout for a specific
-script directly in composer.json:
+To disable the timeout for specific scripts with the static helper directly in
+composer.json:
 
 ```json
 {
@@ -241,6 +243,31 @@ script directly in composer.json:
 }
 ```
 
+To disable the timeout for every script on a given project, you can use the
+composer.json configuration:
+
+```json
+{
+    "config": {
+        "process-timeout": 0
+    }
+}
+```
+
+It's also possible to set the global environment variable to disable the timeout
+of all following scripts in the current terminal environment:
+
+```
+export COMPOSER_PROCESS_TIMEOUT=0
+```
+
+To disable the timeout of a single script call, you must use the `run` composer
+command and specify the `--timeout` parameter:
+
+```
+composer run test --timeout=0
+```
+
 ## Referencing scripts
 
 To enable script re-use and avoid duplicates, you can call a script from another