Skip to content

Commit b777730

Browse files
committed
Wait for old menubar process to exit before launching new one
killRunningApp sent SIGTERM but returned immediately. The subsequent open call raced against the dying process, failing with error -600 on --force reinstalls. Poll up to 5 seconds for exit.
1 parent 63d4da6 commit b777730

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/menubar-installer.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ async function killRunningApp(): Promise<void> {
142142
proc.on('close', () => resolve())
143143
proc.on('error', () => resolve())
144144
})
145+
for (let i = 0; i < 10; i++) {
146+
if (!(await isAppRunning())) return
147+
await new Promise(r => setTimeout(r, 500))
148+
}
145149
}
146150

147151
export async function installMenubarApp(options: { force?: boolean } = {}): Promise<InstallResult> {

0 commit comments

Comments
 (0)