INNER CODE UNIT · TypeScript
withShutdownTimeout
SimonAKing/scrcpy-gui · src/main/main.ts:1067
function withShutdownTimeout(task: Promise<void>): Promise<void> {
return new Promise((settle) => {
const timer = setTimeout(settle, SHUTDOWN_TIMEOUT_MS)
void task.finally(() => {
clearTimeout(timer)
settle()
})
})
}
function beginShutdown(): Promise<void> {
if (shutdownPromise) return shutdownPromise
isQuitting = true
globalShortcut.unregisterAll()
batchAutomationService.stopAll()
stopAllScrcpy()
stopDeviceTracker()
// Hide the window the moment quitting starts. Shutdown waits for ADB, and leaving the