Disabling Composer's script process timeout
•
1 min read
For repetitive processes in my projects, I typically use Composer's script
functionality to make running scripts and executing binaries simpler for myself and my team.
One thing that I run into often is long-running processes, such as watcher scripts or background processes, exceeding Composer's default script timeout of 300 seconds. An example of where I see this most often is large test suites that can take more than 5 minutes to run, normally end-to-end tests.
{
"scripts": {
"e2e": "./bin/run-tests.sh --browser"
}
}
To disable Composer's default timeout, you need to update the entry in the scripts
section of your composer.json
file to call the Composer\\Config::disableProcessTimeout
method before running your own code.
{
"scripts": {
"e2e": [
"Composer\\Config::disableProcessTimeout",
"./bin/run-tests.sh --browser"
],
}
}
You can read more about this in Composer's official documentation here.