don't add homebrew to PATH unless macOS

This commit is contained in:
Nathaniel Landau
2021-12-27 16:12:14 -05:00
parent e7304215bd
commit aff64733a7
2 changed files with 26 additions and 8 deletions

View File

@@ -493,12 +493,21 @@ _homebrewPath_() {
! declare -f "_setPATH_" &>/dev/null && fatal "${FUNCNAME[0]} needs function _setPATH_"
if _setPATH_ "/usr/local/bin" "/opt/homebrew/bin"; then
return 0
if _uname=$(command -v uname); then
if "${_uname}" | tr '[:upper:]' '[:lower:]' | grep -q 'darwin'; then
if _setPATH_ "/usr/local/bin" "/opt/homebrew/bin"; then
return 0
else
return 1
fi
fi
else
return 1
if _setPATH_ "/usr/local/bin" "/opt/homebrew/bin"; then
return 0
else
return 1
fi
fi
}
_parseOptions_() {

View File

@@ -96,10 +96,19 @@ _homebrewPath_() {
! declare -f "_setPATH_" &>/dev/null && fatal "${FUNCNAME[0]} needs function _setPATH_"
if _setPATH_ "/usr/local/bin" "/opt/homebrew/bin"; then
return 0
if _uname=$(command -v uname); then
if "${_uname}" | tr '[:upper:]' '[:lower:]' | grep -q 'darwin'; then
if _setPATH_ "/usr/local/bin" "/opt/homebrew/bin"; then
return 0
else
return 1
fi
fi
else
return 1
if _setPATH_ "/usr/local/bin" "/opt/homebrew/bin"; then
return 0
else
return 1
fi
fi
}