Skip to content

Commit

Permalink
Add support to use existing COMPOSER_PROCESS_TIMEOUT
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Feb 22, 2024
1 parent 1a5ac4a commit 93bfd3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/scripts/tools/add_tools.ps1
Expand Up @@ -23,6 +23,9 @@ Function Edit-ComposerConfig() {
if (-not(Test-Path $composer_json)) {
Set-Content -Path $composer_json -Value "{}"
}
if ($env:COMPOSER_PROCESS_TIMEOUT) {
(Get-Content $src\configs\composer.env -Raw) -replace '(?m)^COMPOSER_PROCESS_TIMEOUT=.*$', "COMPOSER_PROCESS_TIMEOUT=$env:COMPOSER_PROCESS_TIMEOUT" | Set-Content $src\configs\composer.env
}
Add-EnvPATH $src\configs\composer.env
Add-Path $composer_bin
Set-ComposerAuth
Expand Down
6 changes: 5 additions & 1 deletion src/scripts/tools/add_tools.sh
Expand Up @@ -42,7 +42,11 @@ configure_composer() {
echo '{}' | tee "$composer_json" >/dev/null
chmod 644 "$composer_json"
fi
add_env_path "${src:?}"/configs/composer.env
[ -n "$COMPOSER_PROCESS_TIMEOUT" ] && (
sed -i "s/COMPOSER_PROCESS_TIMEOUT.*/COMPOSER_PROCESS_TIMEOUT=$COMPOSER_PROCESS_TIMEOUT/" "${src:?}"/configs/composer.env ||
sed -i '' "s/COMPOSER_PROCESS_TIMEOUT.*/COMPOSER_PROCESS_TIMEOUT=$COMPOSER_PROCESS_TIMEOUT/" "$src"/configs/composer.env
)
add_env_path "$src"/configs/composer.env
add_path "$composer_bin"
set_composer_auth
}
Expand Down

0 comments on commit 93bfd3c

Please sign in to comment.