Skip to content

Commit 382fd9b

Browse files
committed
use async let
1 parent 16a7263 commit 382fd9b

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Coder Desktop/Coder Desktop/Coder_DesktopApp.swift

+6-8
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,13 @@ class AppDelegate: NSObject, NSApplicationDelegate {
6969
// or return `.terminateNow`
7070
func applicationShouldTerminate(_: NSApplication) -> NSApplication.TerminateReply {
7171
Task {
72-
let vpnStop = Task {
73-
if !state.stopVPNOnQuit {
74-
await vpn.stop()
72+
async let vpnTask: Void = {
73+
if await !self.state.stopVPNOnQuit {
74+
await self.vpn.stop()
7575
}
76-
}
77-
let fileSyncStop = Task {
78-
await fileSyncDaemon.stop()
79-
}
80-
_ = await (vpnStop.value, fileSyncStop.value)
76+
}()
77+
async let fileSyncTask: Void = self.fileSyncDaemon.stop()
78+
_ = await (vpnTask, fileSyncTask)
8179
NSApp.reply(toApplicationShouldTerminate: true)
8280
}
8381
return .terminateLater

0 commit comments

Comments
 (0)