From 18d6d73f9462c7ad74dc95d7fb50fdd442248e0a Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Fri, 4 Feb 2022 20:17:10 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20for=20#124=20('valet=20--v?= =?UTF-8?q?ersion'=20failing)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpmon/Domain/Core/Startup.swift | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/phpmon/Domain/Core/Startup.swift b/phpmon/Domain/Core/Startup.swift index 9fff546..5f4bbdf 100644 --- a/phpmon/Domain/Core/Startup.swift +++ b/phpmon/Domain/Core/Startup.swift @@ -49,14 +49,6 @@ class Startup { breaking: true ) - Valet.shared.version = VersionExtractor.from(valet("--version")) - performEnvironmentCheck( - Valet.shared.version == nil, - messageText: "startup.errors.valet_version_unknown.title".localized, - informativeText: "startup.errors.valet_version_unknown.desc".localized, - breaking: true - ) - performEnvironmentCheck( HomebrewDiagnostics.cannotLoadService(), messageText: "startup.errors.services_json_error.title".localized, @@ -81,12 +73,13 @@ class Startup { breaking: true ) - let services = Shell.pipe("\(Paths.brew) services list | grep php") + // Determine the Valet version only AFTER confirming the correct permission is in place + Valet.shared.version = VersionExtractor.from(valet("--version")) performEnvironmentCheck( - (services.countInstances(of: "started") > 1), - messageText: "startup.errors.services.title".localized, - informativeText: "startup.errors.services.desc".localized, - breaking: false + Valet.shared.version == nil, + messageText: "startup.errors.valet_version_unknown.title".localized, + informativeText: "startup.errors.valet_version_unknown.desc".localized, + breaking: true ) if (!failed) {