From 9f47b9e2baa710aac84873310e46994dc6d5ed8f Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Wed, 13 Mar 2024 12:13:12 -0700 Subject: [PATCH] fixup! fix: wait for agd to stop if it's running --- .../public/upgrade-test-scripts/env_setup.sh | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/packages/synthetic-chain/public/upgrade-test-scripts/env_setup.sh b/packages/synthetic-chain/public/upgrade-test-scripts/env_setup.sh index 3ac9a7f0..3fe025b5 100755 --- a/packages/synthetic-chain/public/upgrade-test-scripts/env_setup.sh +++ b/packages/synthetic-chain/public/upgrade-test-scripts/env_setup.sh @@ -66,19 +66,17 @@ await_agd_startable() { local wait="10s" - agd status >/dev/null 2>&1 - local exit_code=$? - - # If agd is running and we have not reached the maximum number of retries, - # wait and try again - if [[ $exit_code -eq 0 && $retries -gt 0 ]]; then - echo "Waiting $wait for agd to stop" - sleep $wait - - wait_and_retry $(($retries - 1)) - else - echo "Cannot start agd because it's already running" - return $exit_code + if agd status >/dev/null 2>&1; then + # agd is running + if [[ $retries -gt 0 ]]; then + echo "Waiting $wait for agd to stop" + sleep $wait + + wait_and_retry $(($retries - 1)) + else + echo "Cannot start agd because it's already running" + return 1 + fi fi }