INNER CODE UNIT · TypeScript

beginShutdown

SimonAKing/scrcpy-gui · src/main/main.ts:1077

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
  // window on screen made quitting from the tray look like nothing had happened, so people
  // clicked Quit again and the second quit tore the app down mid-cleanup.
  if (mainWindow && !mainWindow.isDestroyed()) mainWindow.hide()
  // The ADB server is detached and runs our own adb binary, so it survives the app and keeps
  // the install directory locked on Windows. Stop it whenever this app started it, even if the
  // user opted out of stopping a server that was already running when the app launched.
  const shouldStopAdb = killAdbOnQuit || adbServerStartedByApp()
  shutdownPromise = shouldStopAdb ? withShutdownTimeout(stopAdbServer(quitRuntime)) : Promise.resolve()
  return shutdownPromise
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…