Skip to content

Commit cd8c81b

Browse files
committed
when on OSX, use all relevant nc timeout options
1 parent fa14690 commit cd8c81b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

wait-for

+10-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,19 @@ USAGE
3030
exit "$exitcode"
3131
}
3232

33+
test_connection() {
34+
if [[ "$OSTYPE" == "darwin"* ]]; then
35+
nc -w 1 -G 1 "$1" "$2" > /dev/null 2>&1
36+
else
37+
nc -w 1 "$1" "$2" > /dev/null 2>&1
38+
fi
39+
}
40+
3341
wait_for() {
3442
for i in `seq $TIMEOUT` ; do
3543
# use a 1-second timeout, but still sleep 0.1 seconds after just to be safe
36-
nc -w 1 -z "$HOST" "$PORT" > /dev/null 2>&1
37-
44+
test_connection "$HOST" "$PORT"
45+
3846
result=$?
3947
if [ $result -eq 0 ] ; then
4048
if [ $# -gt 0 ] ; then

0 commit comments

Comments
 (0)