We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d101d61 commit 5a7a56eCopy full SHA for 5a7a56e
wait-for
@@ -30,11 +30,20 @@ USAGE
30
exit "$exitcode"
31
}
32
33
+test_connection() {
34
+ # force a 1-second timeout on darwin (https://stackoverflow.com/a/20460402/2063546)
35
+ if [ -z "${OSTYPE##*darwin*}" ] ; then
36
+ nc -z -w 1 -G 1 "$1" "$2" > /dev/null 2>&1
37
+ else
38
+ nc -z -w 1 "$1" "$2" > /dev/null 2>&1
39
+ fi
40
+}
41
+
42
wait_for() {
43
for i in `seq $TIMEOUT` ; do
- # use a 1-second timeout
- nc -w 1 -z "$HOST" "$PORT" > /dev/null 2>&1
-
44
+ # use a 1-second timeout, but still sleep 0.1 seconds after just to be safe
45
+ test_connection "$HOST" "$PORT"
46
47
result=$?
48
if [ $result -eq 0 ] ; then
49
if [ $# -gt 0 ] ; then
0 commit comments