I changed the code to the following and it's working fine seemingly without any issue. I run it on Manjaro KDE Wayland.
Note I changed app.exit() to app.quit(). quit is supposed to do a graceful exit.
public restart(linuxSafeRestart = true) {
const { app } = require('electron');
if (shim.isPortable()) {
const options = {
execPath: process.env.PORTABLE_EXECUTABLE_FILE,
};
app.relaunch(options);
} else if (shim.isLinux() && linuxSafeRestart) {
// this.showInfoMessageBox(_('The app is now going to close. Please relaunch it to complete the process.'));
app.relaunch();
} else {
app.relaunch();
}
// app.exit();
app.quit();
}