避免“正在进行另一个有效的自制程序更新过程”

oro*_*ome 5 git homebrew

我有一个用于通过Homebrew安装进行维护的脚本,其中包含以下行

brew --config && echo;  brew update && echo; brew upgrade && brew list && echo; brew leaves && echo; brew cask list && echo; 
Run Code Online (Sandbox Code Playgroud)

并(通常)在中运行~。有时,当我运行此脚本时,会得到包含以下内容的输出:

Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
Run Code Online (Sandbox Code Playgroud)

其次是

Error: Another active Homebrew update process is already in progress.
Please wait for it to finish or terminate it to continue.
Run Code Online (Sandbox Code Playgroud)

如何防止这种情况发生?

通过阅读建议的帮助,我希望git gc --auto --aggressive &&首先运行类似明确的方法即可,但是我不清楚如何将其瞄准正确的回购协议。还是原因完全是其他原因?

小智 6

主动自制程序通常来自被卡住的锁定文件...您可以rm /usr/local/var/homebrew/locks/*在错误发生之前在脚本中进行尝试,或者找到特定的有问题的锁定并将其删除。此外,您可以找到无法删除它的原因,以及为什么需要更多信息。如果其他线程上正在运行某些内容,则可能存在某些竞争条件。