Skip to content

Commit

Permalink
updated utils.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
HariSekhon committed Dec 4, 2023
1 parent 14aec0c commit 56916db
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,15 @@ when_url_content(){
while [ "$SECONDS" -lt "$max_secs" ]; do
((try_number+=1))
timestamp "$try_number trying $url"
# shellcheck disable=SC2086
if curl -skL --connect-timeout 1 --max-time 5 ${args:-} "$url" | grep -Eq -- "$expected_regex"; then
#
# tac reads full content to prevent grep closing stdin from causing this curl error:
#
# curl: (23) Failure writing output to destination
#
# ignore tac exit code from breaking the pipefail
#
# shellcheck disable=SC2086,SC2119
if curl -skL --connect-timeout 1 --max-time 5 ${args:-} "$url" | { tac || : ; } | grep -Eq -- "$expected_regex"; then
timestamp "URL content detected '$expected_regex'"
found=1
break
Expand Down

0 comments on commit 56916db

Please sign in to comment.