Skip to content

Commit

Permalink
Merge pull request #70 from jiladahe1997/use_curl_instead_of_ping
Browse files Browse the repository at this point in the history
Replace 'ping' with 'curl' to check the internet connection in build_gdb.sh
  • Loading branch information
rohanrhu authored Dec 18, 2024
2 parents 582daa3 + 50ea611 commit 88f14fe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions build_gdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,16 @@ else # If couldn't find OS by reading the above two files, install for unknown O
fi

# Check for internet connection
which ping > /dev/null
which curl > /dev/null

# Check for internet connection
if [ $? -eq 0 ]; then
ping -c 2 "www.google.com" > /dev/null
curl -I --fail --connect-timeout 30 "www.google.com" > /dev/null 2>&1
if [ $? -ne 0 ]; then
printRedStars
echo -e "${RED}You may not be connected to the internet."
echo -e "${YELLOW}Please check your internet connection${RESET}"
echo -e "${YELLOW}Please check your internet connection"
echo -e "Note: use \"sudo -E\" to pass proxy settings if you are using http(s) proxy${RESET}"
printRedStars
abortScript
fi
Expand Down

0 comments on commit 88f14fe

Please sign in to comment.