Skip to content

fix: relaunch button could silently quit without reopening - #13

Merged
Alfredoalv13 merged 1 commit into
mainfrom
fix/relaunch-exit-race
Jul 24, 2026
Merged

fix: relaunch button could silently quit without reopening#13
Alfredoalv13 merged 1 commit into
mainfrom
fix/relaunch-exit-race

Conversation

@Alfredoalv13

Copy link
Copy Markdown
Owner

Summary

  • PR fix: relaunch via open instead of app.relaunch() so TCC grants are seen #11 fixed `relaunch-app` to spawn `open ` instead of `app.relaunch()` so the new process gets proper independent TCC launch lineage.
  • Verified directly this session that doing so and then immediately calling `app.exit(0)` can silently drop the relaunch entirely - the app quits and never reopens, with no error surfaced anywhere. Reproduced the exact same spawn+exit code as a standalone Node script and confirmed it works fine there, isolating the cause to `app.exit()` itself: it tears the process down harder/faster than a normal quit and was winning the race against `open` handing off to launchd.
  • Fix: wait briefly (500ms) after spawning before calling `app.exit(0)`, and use the absolute `/usr/bin/open` path instead of relying on PATH resolution.

Test plan

  • `tsc --noEmit` clean
  • `npm test` - 94/94 files, 818/818 tests passing
  • Manual: click "Quit & Reopen" from the permission banner several times in a row, confirm the app reliably reopens every single time (not just most of the time)

Verified directly: PR #11's fix (spawn 'open' + immediately call app.exit())
could silently drop the relaunch entirely - the app quit and never came
back, no error, nothing. Reproduced in isolation that the same spawn+exit
pattern works fine as a plain Node script, so this is specific to
app.exit(): it tears the process down harder and faster than a normal quit,
and was winning the race against `open` finishing its handoff to launchd.

Give the spawned process a brief moment to actually launch before tearing
this one down. Also use the absolute /usr/bin/open path instead of relying
on PATH resolution, removing one more variable.
@Alfredoalv13
Alfredoalv13 merged commit acf4984 into main Jul 24, 2026
1 check passed
@Alfredoalv13
Alfredoalv13 deleted the fix/relaunch-exit-race branch July 24, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants