From 44fcf4349dd8466f58c19efee3d7c56f0ce1fe90 Mon Sep 17 00:00:00 2001 From: LMZ Date: Tue, 21 Apr 2026 17:46:36 +0800 Subject: [PATCH] fix: remove unguarded exit(0) fallback from quit flow (issue #35) The 0.5 s + exit(0) fallback was added in d51db56 without a linked issue, without a comment explaining the failure mode it was guarding against, and without persistent background work in stop() that would prevent terminate from succeeding. Removed: DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { exit(0) } Replaced with: comment explaining the decision and under what conditions the fallback may be re-added (specific reproduction + tracking issue). --- Sources/ProcessBarMonitor/Views.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Sources/ProcessBarMonitor/Views.swift b/Sources/ProcessBarMonitor/Views.swift index 8e83dc2..eefc300 100644 --- a/Sources/ProcessBarMonitor/Views.swift +++ b/Sources/ProcessBarMonitor/Views.swift @@ -127,13 +127,14 @@ struct MenuBarContentView: View { window.close() } + // Standard macOS termination. The 0.5 s + exit(0) fallback that existed here + // was added without a linked issue or documented reproduction, and stop() has no + // persistent background work that would prevent terminate from succeeding. + // If a future regression shows terminate is insufficient, re-add the fallback + // only with a comment explaining the specific failure mode and a tracking issue. DispatchQueue.main.async { NSApp.terminate(nil) } - - DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { - exit(0) - } } private var memorySummary: String {