From c725d1984bb54d04a39cd7be4ff141f1a59b7652 Mon Sep 17 00:00:00 2001 From: Ramiro Saenz Date: Mon, 29 Apr 2019 12:45:02 -0300 Subject: [PATCH] Fixed bug on macOS when restart app on new version The app stays open and this confuse the user. --- electron/updater.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/electron/updater.js b/electron/updater.js index 122c10ee..5ac692d9 100644 --- a/electron/updater.js +++ b/electron/updater.js @@ -1,4 +1,4 @@ -const {app, ipcMain} = require('electron'); +const { app, ipcMain } = require('electron'); const { autoUpdater } = require("electron-updater"); const path = require('path'); @@ -12,7 +12,11 @@ const initialize = (window) => { const send = webContents.send.bind(window.webContents); autoUpdater.on('checking-for-update', (event) => send('autoUpdater:checking-for-update')); autoUpdater.on('update-downloaded', (...args) => send('autoUpdater:update-downloaded', ...args)); - ipcMain.on('autoUpdater:quit-and-install', (event) => autoUpdater.quitAndInstall()); + ipcMain.on('autoUpdater:quit-and-install', (event) => { + app.removeAllListeners('window-all-closed'); + BrowserWindow.getAllWindows().forEach((browserWindow) => browserWindow.removeAllListeners('close')); + autoUpdater.quitAndInstall() + }); ipcMain.on('autoUpdater:check-for-updates', (event) => autoUpdater.checkForUpdates()); };