65699912be974d36b732b63e32c3b9428d23ace8

Author
Carlo Sala <carlosalag@protonmail.com>
Committer
Carlo Sala <carlosalag@protonmail.com>
Date

Message

fix(azure): recognize properly linuxbrew

Closes #11644

Diff

 1diff --git a/plugins/azure/azure.plugin.zsh b/plugins/azure/azure.plugin.zsh
 2index 8fec3c1f7c4e04100906941454e690e4e77d974e..22fbea80f61a9168e570adef25d223bda3b36b77 100644
 3--- a/plugins/azure/azure.plugin.zsh
 4+++ b/plugins/azure/azure.plugin.zsh
 5@@ -31,11 +31,9 @@ function _az-homebrew-installed() {
 6   # check if Homebrew is installed
 7   (( $+commands[brew] )) || return 1
 8 
 9-  # speculatively check default brew prefix
10-  if [[ -d /usr/local ]]; then
11-    _brew_prefix=/usr/local
12-  elif [[ -d /opt/homebrew ]]; then
13-    _brew_prefix=/opt/homebrew
14+  # if so, we assume it's default way to install brew
15+  if [[ ${commands[brew]:t2} == bin/brew ]]; then
16+    _brew_prefix="${commands[brew]:h:h}" # remove trailing /bin/brew
17   else
18     # ok, it is not in the default prefix
19     # this call to brew is expensive (about 400 ms), so at least let's make it only once