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

Lines changed: 6 additions & 8 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy