Skip to content

Commit d101d61

Browse files
committed
Make nc time out in a known amount of time instead of hanging
1 parent 4a309cc commit d101d61

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

wait-for

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ USAGE
3232

3333
wait_for() {
3434
for i in `seq $TIMEOUT` ; do
35-
nc -z "$HOST" "$PORT" > /dev/null 2>&1
35+
# use a 1-second timeout
36+
nc -w 1 -z "$HOST" "$PORT" > /dev/null 2>&1
3637

3738
result=$?
3839
if [ $result -eq 0 ] ; then

0 commit comments

Comments
 (0)