Add setImmediate to see if this fixes the macOS update bug

This commit is contained in:
rafael-aero
2021-11-02 15:39:57 +01:00
parent 134a5b1365
commit 5477bd7f36
2 changed files with 32 additions and 28 deletions

View File

@@ -102,20 +102,22 @@ module.exports = (socket, app) => {
});
socket.on('autoUpdaterQuitAndInstall', async (isSilent, isForceRunAfter) => {
app.removeAllListeners("window-all-closed");
const windows = electron_1.BrowserWindow.getAllWindows();
if (windows.length) {
windows.forEach(w => {
try {
w.removeAllListeners('close');
w.hide();
w.destroy();
}
catch {
//ignore, probably already destroyed
}
});
}
electron_updater_1.autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
setImmediate(() => {
const windows = electron_1.BrowserWindow.getAllWindows();
if (windows.length) {
windows.forEach(w => {
try {
w.removeAllListeners('close');
w.hide();
w.destroy();
}
catch {
//ignore, probably already destroyed
}
});
}
electron_updater_1.autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
});
});
socket.on('autoUpdaterDownloadUpdate', async (guid) => {
const downloadedPath = await electron_updater_1.autoUpdater.downloadUpdate();

View File

@@ -130,20 +130,22 @@ export = (socket: Socket, app: Electron.App) => {
socket.on('autoUpdaterQuitAndInstall', async (isSilent, isForceRunAfter) => {
app.removeAllListeners("window-all-closed");
const windows = BrowserWindow.getAllWindows();
if (windows.length) {
windows.forEach(w => {
try {
w.removeAllListeners('close');
w.hide();
w.destroy();
}
catch {
//ignore, probably already destroyed
}
});
}
autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
setImmediate(() => {
const windows = BrowserWindow.getAllWindows();
if (windows.length) {
windows.forEach(w => {
try {
w.removeAllListeners('close');
w.hide();
w.destroy();
}
catch {
//ignore, probably already destroyed
}
});
}
autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
});
});
socket.on('autoUpdaterDownloadUpdate', async (guid) => {