fix: improve app restart and gateway logs

This commit is contained in:
Peter Steinberger
2025-12-09 18:36:49 +00:00
parent 0d4bf1c15a
commit 2adb14c320
6 changed files with 610 additions and 3 deletions

View File

@@ -197,6 +197,7 @@ struct DebugSettings: View {
Button("Restart app") { self.relaunch() }
Button("Reveal app in Finder") { self.revealApp() }
Button("Restart Gateway") { DebugActions.restartGateway() }
Button("Clear log") { GatewayProcessManager.shared.clearLog() }
}
.buttonStyle(.bordered)
Spacer(minLength: 8)
@@ -268,10 +269,13 @@ struct DebugSettings: View {
private func relaunch() {
let url = Bundle.main.bundleURL
let task = Process()
task.launchPath = "/usr/bin/open"
task.arguments = [url.path]
task.launchPath = "/bin/sh"
task.arguments = ["-c", "sleep 0.3; open -n \"\(url.path)\""]
task.standardOutput = nil
task.standardError = nil
task.standardInput = nil
try? task.run()
task.waitUntilExit()
// Terminate current instance; spawned shell re-opens after a short delay.
NSApp.terminate(nil)
}