diff --git a/README.md b/README.md index a31be9b..f1956f7 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 \ No newline at end of file + docker run -t wait-for diff --git a/wait-for b/wait-for index ddfc39e..cef482a 100755 --- a/wait-for +++ b/wait-for @@ -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