From ff42a4e3b745d59d68b86e184f5d8d1b755ed549 Mon Sep 17 00:00:00 2001 From: Adrian Ho Date: Wed, 22 Mar 2023 18:03:47 +0800 Subject: [PATCH] update*: check shim output The shims _Should Not Fail_, but [when bugs happen](https://github.com/orgs/Homebrew/discussions/4331), they just cause confusing errors. --- Library/Homebrew/cmd/update-reset.sh | 4 ++++ Library/Homebrew/cmd/update.sh | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/Library/Homebrew/cmd/update-reset.sh b/Library/Homebrew/cmd/update-reset.sh index a7b597afa5..f87d623b25 100644 --- a/Library/Homebrew/cmd/update-reset.sh +++ b/Library/Homebrew/cmd/update-reset.sh @@ -12,6 +12,10 @@ git() { # HOMEBREW_LIBRARY is set by bin/brew # shellcheck disable=SC2154 GIT_EXECUTABLE="$("${HOMEBREW_LIBRARY}/Homebrew/shims/shared/git" --homebrew=print-path)" + if [[ -z "${GIT_EXECUTABLE}" ]] + then + odie "Can't find a working Git!" + fi fi "${GIT_EXECUTABLE}" "$@" } diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index cf096c46f8..2bcee9996e 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -25,6 +25,10 @@ curl() { if [[ -z "${CURL_EXECUTABLE}" ]] then CURL_EXECUTABLE="$("${HOMEBREW_LIBRARY}/Homebrew/shims/shared/curl" --homebrew=print-path)" + if [[ -z "${CURL_EXECUTABLE}" ]] + then + odie "Can't find a working Curl!" + fi fi "${CURL_EXECUTABLE}" "$@" } @@ -33,6 +37,10 @@ git() { if [[ -z "${GIT_EXECUTABLE}" ]] then GIT_EXECUTABLE="$("${HOMEBREW_LIBRARY}/Homebrew/shims/shared/git" --homebrew=print-path)" + if [[ -z "${GIT_EXECUTABLE}" ]] + then + odie "Can't find a working Git!" + fi fi "${GIT_EXECUTABLE}" "$@" }