From a042298a4afb459e397135ca89f3670332524fef Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Fri, 6 Dec 2024 22:03:57 +0800 Subject: [PATCH] Update wgd.sh --- src/wgd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wgd.sh b/src/wgd.sh index 3df5d1e..37716d8 100755 --- a/src/wgd.sh +++ b/src/wgd.sh @@ -260,7 +260,7 @@ _determinePypiMirror(){ # Extract the hostname from the URL hostname=$(echo "$url" | awk -F/ '{print $3}') # Ping the hostname once and extract the RTT - rtt=$(ping -c 1 "$hostname" 2>/dev/null | grep 'time=' | awk -F'time=' '{print $2}' | awk '{print $1}') + rtt=$(ping -c 1 -W 1 "$hostname" 2>/dev/null | grep 'time=' | awk -F'time=' '{print $2}' | awk '{print $1}') # Handle cases where the hostname is not reachable if [ -z "$rtt" ]; then rtt="9999"