brew.sh: communicate when autoupdate runs for long
This will ease user anxiety when `brew install foo' is typed but nothing seems to happen.
This commit is contained in:
parent
8d5df2ea87
commit
0ca697ad2f
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user