Use file descriptor 3 for main deployment loop

Before this, some deployment scripts would interact with STDIN and that would cause this loop to skip some elements. By using descriptor 3 we avoid clashing with the very common stdin and stdout.
This commit is contained in:
Jacobo de Vera
2025-09-01 00:07:44 +01:00
committed by neil
parent ab7835ec58
commit 96f38655b4

View File

@@ -235,7 +235,7 @@ _deploy_services() {
_failedServices="" _failedServices=""
_failedCount=0 _failedCount=0
while read -r _service; do while read -r _service <&3; do
_debug2 "Service" "$_service" _debug2 "Service" "$_service"
_hook=$(yq e ".services[] | select(.name == \"$_service\").hook" "$_deploy_file") _hook=$(yq e ".services[] | select(.name == \"$_service\").hook" "$_deploy_file")
_envs=$(yq e ".services[] | select(.name == \"$_service\").environment" "$_deploy_file") _envs=$(yq e ".services[] | select(.name == \"$_service\").environment" "$_deploy_file")
@@ -246,7 +246,7 @@ _deploy_services() {
_failedCount=$((_failedCount + 1)) _failedCount=$((_failedCount + 1))
fi fi
_clear_envs "$_envs" _clear_envs "$_envs"
done < "$_tempfile" done 3< "$_tempfile"
_debug3 "Failed services" "$_failedServices" _debug3 "Failed services" "$_failedServices"
_debug2 "Failed count" "$_failedCount" _debug2 "Failed count" "$_failedCount"