refi64/zypak

Handling electron.relaunch()

dbrgn opened this issue · 1 comments

dbrgn commented

When calling electron.app.relaunch() followed by electron.app.exit(), Electron should restart: https://www.electronjs.org/docs/latest/api/app#apprelaunchoptions This works fine in a standalone binary, but fails to restart in Flatpak.

I assume Electron stores the path and args on start, and then launches a new detached process followed by exiting. This way, zypak will exit (because the child process has terminated) and Flatpak will exit as well (because zypak is the entrypoint script). (Here's the Electron relaunch implementation: https://github.com/electron/electron/blob/19baea4bc2be42ac0568bacab9e7365bb3f8ce26/shell/browser/api/electron_api_app.cc#L1152-L1186)

I saw that zypak has ZYPAK_SPAWN_LATEST_ON_REEXEC, but that seems to be something different, right?

Is there a way to get relaunching to work (including a properly set up sandbox) with zypak as launcher / entrypoint?

This should be fixed in the latest beta v2023.02beta.1.