Improve service stop

This commit is contained in:
世界
2024-03-15 16:25:20 +08:00
parent 95e9bc5fb2
commit 7098a84187
5 changed files with 32 additions and 16 deletions
@@ -1,3 +1,4 @@
import Libbox
import Library
import NetworkExtension
import SwiftUI
@@ -80,7 +81,16 @@ public struct StartStopButton: View {
try await profile.start()
await environments.logClient.connect()
} else {
var err: Error?
do {
try LibboxNewStandaloneCommandClient()!.serviceClose()
} catch {
err = error
}
await profile.stop()
if let err {
throw err
}
}
} catch {
await MainActor.run {