Skip to content

Commit

Permalink
fix: better exit app #251
Browse files Browse the repository at this point in the history
  • Loading branch information
caoxiemeihao committed Sep 19, 2024
1 parent 927885d commit 3239718
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ export async function startup(
startup.hookedProcessExit = false
startup.exit = async () => {
if (process.electronApp) {
process.electronApp.removeAllListeners()
treeKillSync(process.electronApp.pid!)
await new Promise((resolve) => {
process.electronApp.removeAllListeners()
process.electronApp.once('exit', resolve)
treeKillSync(process.electronApp.pid!)
})
}
}

0 comments on commit 3239718

Please sign in to comment.