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 Alternatively, you specify the host and port as host:port
-s | --strict Only execute subcommand if the test succeeds -s | --strict Only execute subcommand if the test succeeds
-q | --quiet Don't output any status messages -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 -nc | --netcat Force to use netcat instead of bash tcp detection
-t TIMEOUT | --timeout=TIMEOUT -t TIMEOUT | --timeout=TIMEOUT
Timeout in seconds, zero for no timeout Timeout in seconds, zero for no timeout
@ -34,10 +35,14 @@ wait_for()
while : while :
do do
if [[ $WAITFORIT_ISBUSY -eq 1 ]] || [[ $WAITFORIT_NETCAT -eq 1 ]]; then 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=$? WAITFORIT_result=$?
else 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=$? WAITFORIT_result=$?
fi fi
if [[ $WAITFORIT_result -eq 0 ]]; then if [[ $WAITFORIT_result -eq 0 ]]; then
@ -82,6 +87,10 @@ do
WAITFORIT_CHILD=1 WAITFORIT_CHILD=1
shift 1 shift 1
;; ;;
-v| --verbose)
export WAITFORIT_VERBOSE=v
shift 1
;;
-q | --quiet) -q | --quiet)
WAITFORIT_QUIET=1 WAITFORIT_QUIET=1
shift 1 shift 1

Loading…
Cancel
Save