Add debug messages for update methods

This commit is contained in:
rafael-aero
2022-02-10 00:00:51 +01:00
parent 13a3753214
commit c8552041fb
3 changed files with 20 additions and 2 deletions

View File

@@ -101,9 +101,12 @@ module.exports = (socket, app) => {
});
});
socket.on('autoUpdaterQuitAndInstall', async (isSilent, isForceRunAfter) => {
console.log('running autoUpdaterQuitAndInstall');
app.removeAllListeners("window-all-closed");
const windows = electron_1.BrowserWindow.getAllWindows();
if (windows.length) {
if (windows && windows.length) {
windows.forEach(w => {
try {
w.removeAllListeners('close');
@@ -118,6 +121,9 @@ module.exports = (socket, app) => {
//The call to quitAndInstall needs to happen after the windows
//get a chance to close and release resources, so it must be done on a timeout
setTimeout(() => {
console.log('running autoUpdater.quitAndInstall');
console.log('isSilent:' + isSilent);
console.log('isForceRunAfter:' + isForceRunAfter);
electron_updater_1.autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
}, 100);
});

View File

@@ -130,9 +130,11 @@ export = (socket: Socket, app: Electron.App) => {
});
socket.on('autoUpdaterQuitAndInstall', async (isSilent, isForceRunAfter) => {
console.log('running autoUpdaterQuitAndInstall');
app.removeAllListeners("window-all-closed");
const windows = BrowserWindow.getAllWindows();
if (windows.length) {
if (windows && windows.length) {
windows.forEach(w => {
try {
w.removeAllListeners('close');
@@ -147,6 +149,9 @@ export = (socket: Socket, app: Electron.App) => {
//The call to quitAndInstall needs to happen after the windows
//get a chance to close and release resources, so it must be done on a timeout
setTimeout(() => {
console.log('running autoUpdater.quitAndInstall');
console.log('isSilent:' + isSilent);
console.log('isForceRunAfter:' + isForceRunAfter);
autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
}, 100);
});

View File

@@ -55,6 +55,8 @@ app.on('will-finish-launching', () => {
});
function prepareForUpdate() {
console.log('closing all windows before update');
ignoreApiProcessClosed = true;
app.removeAllListeners("window-all-closed");
@@ -487,14 +489,19 @@ function startAspCoreBackendWithWatch(electronPort) {
if (code != 0) {
console.log(`Will quit Electron, as exit code != 0 (got ${code})`);
}
console.log('Will quit Electron now');
app.exit(code);
}
else if (os.platform() === 'darwin') {
console.log('.NET process and Electron has a pending update, will force quit in 10s...');
//There is a bug on the updater on macOS never quiting and starting the update process
//We give Squirrel.Mac enough time to access the update file, and then just force-exit here
setTimeout(() => app.exit(0), 10_000);
}
else {
console.log('.NET process and Electron has a pending update...');
}
});
if (detachedProcess) {