Created the --verbose mode to show progress each attempt (for slow CI machines)

pull/113/head
evandrocoan 3 years ago
parent 36baf32e9e
commit 10753549cf

@ -15,6 +15,7 @@ Usage:
Alternatively, you specify the host and port as host:port
-s | --strict Only execute subcommand if the test succeeds
-q | --quiet Don't output any status messages
-v | --verbose Output each failed attempt to connect
-nc | --netcat Force to use netcat instead of bash tcp detection
-t TIMEOUT | --timeout=TIMEOUT
Timeout in seconds, zero for no timeout
@ -34,10 +35,14 @@ wait_for()
while :
do
if [[ $WAITFORIT_ISBUSY -eq 1 ]] || [[ $WAITFORIT_NETCAT -eq 1 ]]; then
nc -z $WAITFORIT_HOST $WAITFORIT_PORT
nc -z${WAITFORIT_VERBOSE:-} $WAITFORIT_HOST $WAITFORIT_PORT
WAITFORIT_result=$?
else
(echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1
if [[ -z "$WAITFORIT_VERBOSE" ]]; then
(echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1
else
(echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT)
fi
WAITFORIT_result=$?
fi
if [[ $WAITFORIT_result -eq 0 ]]; then
@ -82,6 +87,10 @@ do
WAITFORIT_CHILD=1
shift 1
;;
-v| --verbose)
export WAITFORIT_VERBOSE=v
shift 1
;;
-q | --quiet)
WAITFORIT_QUIET=1
shift 1

Loading…
Cancel
Save