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.
This commit is contained in:
Adrian Ho 2023-03-22 18:03:47 +08:00
parent ce07d6ad31
commit ff42a4e3b7
2 changed files with 12 additions and 0 deletions

View File

@ -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}" "$@"
}

View File

@ -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}" "$@"
}