Skip to content

Commit 22d68b4

Browse files
committed
feat(option): Restrict the timeout input to non-negative integers
1 parent fd4909a commit 22d68b4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

wait-for

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ do
5555
;;
5656
-t)
5757
TIMEOUT="$2"
58-
if [ "$TIMEOUT" = "" ]; then break; fi
5958
shift 2
6059
;;
6160
--timeout=*)
@@ -76,6 +75,11 @@ do
7675
esac
7776
done
7877

78+
if ! [ "$TIMEOUT" -ge 0 ] 2>/dev/null; then
79+
echoerr "Error: invalid timeout '$TIMEOUT'"
80+
usage 3
81+
fi
82+
7983
if [ "$HOST" = "" -o "$PORT" = "" ]; then
8084
echoerr "Error: you need to provide a host and port to test."
8185
usage 2

0 commit comments

Comments
 (0)