From ce8afe1c95c2594fa0a26c0b13d95df05f993754 Mon Sep 17 00:00:00 2001 From: Guilherme Rossato Date: Mon, 13 May 2019 10:26:27 -0300 Subject: [PATCH] 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. --- doc/articles/scripts.md | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/doc/articles/scripts.md b/doc/articles/scripts.md index 52ed86073..99ffd94dc 100644 --- a/doc/articles/scripts.md +++ b/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