浏览代码

fix(azure): recognize properly linuxbrew

Closes #11644
Carlo Sala 2 年之前
父节点
当前提交
65699912be
共有 1 个文件被更改,包括 3 次插入5 次删除
  1. 3 5
      plugins/azure/azure.plugin.zsh

+ 3 - 5
plugins/azure/azure.plugin.zsh

@@ -31,11 +31,9 @@ function _az-homebrew-installed() {
   # check if Homebrew is installed
   (( $+commands[brew] )) || return 1
 
-  # speculatively check default brew prefix
-  if [[ -d /usr/local ]]; then
-    _brew_prefix=/usr/local
-  elif [[ -d /opt/homebrew ]]; then
-    _brew_prefix=/opt/homebrew
+  # if so, we assume it's default way to install brew
+  if [[ ${commands[brew]:t2} == bin/brew ]]; then
+    _brew_prefix="${commands[brew]:h:h}" # remove trailing /bin/brew
   else
     # ok, it is not in the default prefix
     # this call to brew is expensive (about 400 ms), so at least let's make it only once