ciderapp / Cider

A new cross-platform Apple Music experience based on Electron and Vue.js written from scratch with performance in mind. 🚀
https://cider.sh
GNU Affero General Public License v3.0
7.17k stars 343 forks source link

[Bug]: app.relaunch() not working in linux #582

Closed lehades closed 2 years ago

lehades commented 2 years ago

Describe the Bug

I'm working on a plugin and i've found that trying to restart the app under linux does not work (in windows everything works as intended).

electron's standard procedure to restart the app is:

app.relaunch();
app.quit();

Steps to Reproduce

1- Call these functions in a plugin

app.relaunch();
app.quit();

2- App closes (Linux & Windows) 3- App reopens (Windows), App stays closed (Linux)

Environment Information

Anything else?

https://www.electronjs.org/es/docs/latest/api/app#apprelaunchoptions

According to the docs there is an optional execPath which i've tried passing as process.execPath, process.argv0 or hardcoding the app path without any success

Code of Conduct

vapormusic commented 2 years ago

Hey can you try on cider's devtools console with ipcRenderer.send('relaunchApp',''); ?

coredev-uk commented 2 years ago

This never worked correctly, electron's relaunch function doesn't seem to operate correctly on Linux.

lehades commented 2 years ago

Tried: ipcRenderer.send('relaunchApp',''); Console result was 'undefined'

Remembered seeing somewhere else and tried: ipcRenderer.invoke("relaunchApp") Same result... app closed and never opened again.

lehades commented 2 years ago

This never worked correctly, electron's relaunch function doesn't seem to operate correctly on Linux.

It's a fact that it has some issues but i've used it succesfully before in some other projects (ytmdesktop being one of them), but i'm actually stuck here.

Since I saw there's a WIP into restarting the app after an update I tried asking... I'm guessing whoever is working on that would end up hitting the same roadblock.

quacksire commented 2 years ago

By default, the new instance will use the same working directory and command line arguments with current instance. When args is specified, the args will be passed as command line arguments instead. When execPath is specified, the execPath will be executed for relaunch instead of current app.

Note that this method does not quit the app when executed, you have to call app.quit or app.exit after calling app.relaunch to make the app restart.

When app.relaunch is called for multiple times, multiple instances will be started after current instance exited.

coredev-uk commented 2 years ago

I've attempted to fix this with the recommended patch found here, however from personal testing, this doesn't fix this. Feel free to test it yourself, but not much more can be done to resolve this.