⏱️ SetProcessTimeout
Sets the Composer process timeout (in seconds). Equivalent to setting the COMPOSER_PROCESS_TIMEOUT environment variable.
When to use
Use this when installing large dependencies or on a slow network where the default 300-second timeout is insufficient, to prevent Composer from being interrupted during download/clone.
Signature
go
func SetProcessTimeout(seconds int) errorParameters
| Parameter | Type | Description |
|---|---|---|
seconds | int | Timeout in seconds, e.g. 600 |
Return value
| Return value | Type | Description |
|---|---|---|
| Sole return value | error | Returned when the setting fails (usually nil) |
Example
go
package main
import (
"fmt"
"log"
"github.com/scagogogo/composer-skills/pkg/composer"
)
func main() {
if err := composer.SetProcessTimeout(600); err != nil {
log.Fatalf("set timeout failed: %v", err)
}
fmt.Println("Composer process timeout set to 600 seconds")
}Advanced
- This function sets
EnvComposerProcessTimeoutunder the hood; the same effect can be achieved with the generic method SetEnvVariable. - To read the current value, use GetEnvVariable(
composer.EnvComposerProcessTimeout). - Command-level timeouts on the Go side can also be controlled via
RunWithTimeout; see Run.