Properly handle different netcat command names. (#10883)
Austin S. Hemmelgarn committed
Mar 31, 2021 at 07:20 UTC
a843b893210587ffeb91bdbf866779555b755596
1 file changed
+10
-1
packaging/scripts/test.sh
+10
-1
@@ -12,12 +12,21 @@ wait_for() {
12
name="${3}"
13
timeout="30"
14
15
+ if command -v nc > /dev/null ; then
16
+ netcat="nc"
17
+ elif command -v netcat > /dev/null ; then
18
+ netcat="netcat"
19
+ else
20
+ printf "Unable to find a usable netcat command.\n"
21
+ return 1
22
+ fi
23
+
24
printf "Waiting for %s on %s:%s ... " "${name}" "${host}" "${port}"
25
26
sleep 30
27
28
i=0
20
- while ! nc -z "${host}" "${port}"; do
29
+ while ! ${netcat} -z "${host}" "${port}"; do
30
sleep 1
31
if [ "$i" -gt "$timeout" ]; then
32
printf "Timed out!\n"