Skip to content
Snippets Groups Projects
Commit 3cef6a3a authored by Mike McQuaid's avatar Mike McQuaid Committed by GitHub
Browse files

Merge pull request #1413 from zmwangx/update-preinstall-message

brew.sh: display message when auto update runs for too long
parents 297c6005 0ca697ad
No related branches found
No related tags found
No related merge requests found
......@@ -296,6 +296,13 @@ source "$HOMEBREW_LIBRARY/Homebrew/utils/analytics.sh"
setup-analytics
report-analytics-screenview-command
# Let user know we're still updating Homebrew if brew update --preinstall
# exceeds 3 seconds.
update-preinstall-timer() {
sleep 3
echo 'Updating Homebrew...' >&2
}
update-preinstall() {
[[ -z "$HOMEBREW_HELP" ]] || return
[[ -z "$HOMEBREW_NO_AUTO_UPDATE" ]] || return
......@@ -306,7 +313,19 @@ update-preinstall() {
if [[ "$HOMEBREW_COMMAND" = "install" || "$HOMEBREW_COMMAND" = "upgrade" || "$HOMEBREW_COMMAND" = "tap" ]]
then
if [[ -z "$HOMEBREW_VERBOSE" ]]
then
update-preinstall-timer &
timer_pid=$!
fi
brew update --preinstall
if [[ -n "$timer_pid" ]]
then
kill "$timer_pid" 2>/dev/null
wait "$timer_pid" 2>/dev/null
fi
fi
# If brew update --preinstall did a migration then export the new locations.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment