File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
2- # Use this script to test if a given TCP host/port are available
2+ # Use this script to test if a given TCP host/port are available
33
44WAITFORIT_cmdname=${0##*/ }
55
@@ -141,16 +141,20 @@ WAITFORIT_STRICT=${WAITFORIT_STRICT:-0}
141141WAITFORIT_CHILD=${WAITFORIT_CHILD:- 0}
142142WAITFORIT_QUIET=${WAITFORIT_QUIET:- 0}
143143
144- # check to see if timeout is from busybox?
144+ # Check to see if timeout is from busybox?
145145WAITFORIT_TIMEOUT_PATH=$( type -p timeout)
146146WAITFORIT_TIMEOUT_PATH=$( realpath $WAITFORIT_TIMEOUT_PATH 2> /dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH )
147+
148+ WAITFORIT_BUSYTIMEFLAG=" "
147149if [[ $WAITFORIT_TIMEOUT_PATH =~ " busybox" ]]; then
148- WAITFORIT_ISBUSY=1
150+ WAITFORIT_ISBUSY=1
151+ # Check if busybox timeout uses -t flag
152+ # (recent Alpine versions don't support -t anymore)
153+ if timeout & > /dev/stdout | grep -q -e ' -t ' ; then
149154 WAITFORIT_BUSYTIMEFLAG=" -t"
150-
155+ fi
151156else
152- WAITFORIT_ISBUSY=0
153- WAITFORIT_BUSYTIMEFLAG=" "
157+ WAITFORIT_ISBUSY=0
154158fi
155159
156160if [[ $WAITFORIT_CHILD -gt 0 ]]; then
You can’t perform that action at this time.
0 commit comments