Skip to content

Commit

Permalink
feat(option): Restrict the timeout input to non-negative integers
Browse files Browse the repository at this point in the history
  • Loading branch information
sd-yip authored and Addono committed Feb 2, 2021
1 parent 89ec638 commit c4d125f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion wait-for
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ do
;;
-t)
TIMEOUT="$2"
if [ "$TIMEOUT" = "" ]; then break; fi
shift 2
;;
--timeout=*)
Expand All @@ -76,6 +75,11 @@ do
esac
done

if ! [ "$TIMEOUT" -ge 0 ] 2>/dev/null; then
echoerr "Error: invalid timeout '$TIMEOUT'"
usage 3
fi

if [ "$HOST" = "" -o "$PORT" = "" ]; then
echoerr "Error: you need to provide a host and port to test."
usage 2
Expand Down

0 comments on commit c4d125f

Please sign in to comment.