mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 12:00:09 +02:00
🐛 Prevent #61 from crashing the app
This commit is contained in:
@ -762,7 +762,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MARKETING_VERSION = "4.1-beta3";
|
||||
MARKETING_VERSION = "4.1-beta4";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@ -787,7 +787,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 11.0;
|
||||
MARKETING_VERSION = "4.1-beta3";
|
||||
MARKETING_VERSION = "4.1-beta4";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.nicoverbruggen.phpmon;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
@ -11,7 +11,7 @@ import Foundation
|
||||
class PhpInstallation {
|
||||
|
||||
var longVersion: String
|
||||
var homebrewInfo: HomebrewPackage
|
||||
var homebrewInfo: HomebrewPackage?
|
||||
|
||||
/**
|
||||
In order to determine details about a PHP installation, we’ll simply run `php-config --version`
|
||||
@ -29,10 +29,17 @@ class PhpInstallation {
|
||||
}
|
||||
|
||||
let info = Shell.pipe("\(Paths.brew) info php@\(version) --json")
|
||||
self.homebrewInfo = try! JSONDecoder().decode(
|
||||
[HomebrewPackage].self,
|
||||
from: info.data(using: .utf8)!
|
||||
).first!
|
||||
|
||||
do {
|
||||
self.homebrewInfo = try JSONDecoder().decode(
|
||||
[HomebrewPackage].self,
|
||||
from: info.data(using: .utf8)!
|
||||
).first ?? nil
|
||||
} catch {
|
||||
// TODO: Perhaps show a modal to indicate there’s an issue with Homebrew?
|
||||
print("There was an issue parsing Homebrew info for PHP \(version)")
|
||||
self.homebrewInfo = nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user