Skip to content

Commit 4e61757

Browse files
committed
Reworked do_wait function which cause error on strict mode
1 parent 7917df4 commit 4e61757

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

wait-host.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,19 @@ function echoerr() {
6363
}
6464

6565
function do_wait() {
66-
until nc -z -w 1 "$HOST" "$PORT"; do
66+
while :
67+
do
68+
# Check for connection on host
69+
nc -z -w 1 "$HOST" "$PORT"
6770
result=$?
68-
echoerr "$MESSAGE"
69-
sleep $DELAY
71+
72+
# Display message on error
73+
if [ $result -ne 0 ]; then
74+
echoerr "$MESSAGE"
75+
sleep $DELAY
76+
else
77+
break
78+
fi
7079
done
7180

7281
return $result

0 commit comments

Comments
 (0)