File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,8 +31,10 @@ WP_CORE_FILE="$WP_CORE_DIR"/wp-settings.php
3131download () {
3232 if command -v curl > /dev/null 2>&1 ; then
3333 curl -L -s " $1 " > " $2 " ;
34+ return $?
3435 elif command -v wget > /dev/null 2>&1 ; then
3536 wget -nv -O " $2 " " $1 "
37+ return $?
3638 else
3739 echo -e " ${RED} Error: Neither curl nor wget is installed.${RESET} "
3840 exit 1
@@ -43,10 +45,14 @@ check_for_updates() {
4345 local remote_url=" https://raw.githubusercontent.com/wp-cli/scaffold-command/main/templates/install-wp-tests.sh"
4446 local tmp_script=" $TMPDIR /install-wp-tests.sh.latest"
4547
46- download " $remote_url " " $tmp_script "
48+ if ! download " $remote_url " " $tmp_script " ; then
49+ echo -e " ${YELLOW} Warning: Failed to download the latest version of the script for update check.${RESET} "
50+ return
51+ fi
4752
48- if [ ! -f " $tmp_script " ]; then
49- echo -e " ${YELLOW} Warning: Could not download the latest version of the script for update check.${RESET} "
53+ if [ ! -f " $tmp_script " ] || [ ! -s " $tmp_script " ]; then
54+ echo -e " ${YELLOW} Warning: Downloaded script is missing or empty, cannot check for updates.${RESET} "
55+ rm -f " $tmp_script "
5056 return
5157 fi
5258
You can’t perform that action at this time.
0 commit comments