Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

When using this tool, you only need to pick the `wait-for` file as part of your project.

[![Build Status](https://travis-ci.org/Eficode/wait-for.svg?branch=master)](https://travis-ci.org/Eficode/wait-for)
[![Build Status](https://travis-ci.org/eficode/wait-for.svg?branch=master)](https://travis-ci.org/eficode/wait-for)

## Usage

Expand Down Expand Up @@ -48,4 +48,4 @@ services:
Ironically testing is done using [bats](https://github.com/sstephenson/bats), which on the other hand is depending on [bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)).

docker build -t wait-for .
docker run -t wait-for
docker run -t wait-for
8 changes: 6 additions & 2 deletions wait-for
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ USAGE

wait_for() {
for i in `seq $TIMEOUT` ; do
nc -z "$HOST" "$PORT" > /dev/null 2>&1

if which nc > /dev/null; then
nc -z "$HOST" "$PORT" > /dev/null 2>&1
else
(echo > /dev/tcp/$HOST/$PORT) > /dev/null 2>&1
fi

result=$?
if [ $result -eq 0 ] ; then
if [ $# -gt 0 ] ; then
Expand Down