Skip to content

Commit 7703ce7

Browse files
committed
fallback to /dev/tcp if no netcat
1 parent 8283864 commit 7703ce7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

wait-for

+6-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ USAGE
2121

2222
wait_for() {
2323
for i in `seq $TIMEOUT` ; do
24-
nc -z "$HOST" "$PORT" > /dev/null 2>&1
25-
24+
if which nc > /dev/null; then
25+
nc -z "$HOST" "$PORT" > /dev/null 2>&1
26+
else
27+
(echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1
28+
fi
29+
2630
result=$?
2731
if [ $result -eq 0 ] ; then
2832
if [ $# -gt 0 ] ; then

0 commit comments

Comments
 (0)