From 07523c314c9fe13eb888fb9e36c133236b59e46a Mon Sep 17 00:00:00 2001 From: D3SOX Date: Wed, 18 May 2022 20:12:01 +0200 Subject: [PATCH] Revert "Revert "fix: instance detection (#253)"" This reverts commit 0f37a36b105328bbeab3816df383a230907f98d6. --- src/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index a8fcf00..2ec8178 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -65,11 +65,16 @@ int main(int argc, char **arguments) gGuard = std::make_shared("soundux-guard"); } - if (gGuard->other_instance()) + if (auto other_instance = gGuard->other_instance(); other_instance.has_value() && other_instance.value()) { Fancy::fancy.logTime().failure() << "Another Instance is already running!" << std::endl; return 1; } + else if (!other_instance.has_value()) // NOLINT + { + Fancy::fancy.logTime().warning() << "Failed to check for other instances: " << other_instance.error() + << std::endl; + } gConfig.load(); gData.set(gConfig.data);