Skip to content

Commit

Permalink
Fix checking for existing php formula on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Sep 22, 2023
1 parent 9102646 commit 10c12b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/scripts/darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,11 @@ fix_dependencies() {

# Function to get PHP version if it is already installed using Homebrew.
get_brewed_php() {
php_cellar="$brew_prefix"/Cellar/php
if [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
cellar="$brew_prefix"/Cellar
php_cellar="$cellar"/php
if [ -d "$cellar" ] && ! [[ "$(find "$cellar" -maxdepth 1 -name "php@$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
php_semver | cut -c 1-3
elif [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
php_semver | cut -c 1-3
else
echo 'false';
Expand Down

0 comments on commit 10c12b9

Please sign in to comment.