[Updater > v2] Catch errors in RetainAsar incase it fails for some reason

This commit is contained in:
Ducko 2022-06-08 20:32:24 +01:00
parent b089e48bd7
commit c3b020f0f1

View file

@ -151,8 +151,12 @@ class Updater extends require('events').EventEmitter {
const cAsar = getAsar(cur); const cAsar = getAsar(cur);
const nAsar = getAsar(next); const nAsar = getAsar(next);
fs.copyFileSync(nAsar, nAsar + '.backup'); // Copy new app.asar to backup file (<new>/app.asar -> <new>/app.asar.backup) try {
fs.copyFileSync(cAsar, nAsar); // Copy old app.asar to new app.asar (<old>/app.asar -> <new>/app.asar) fs.copyFileSync(nAsar, nAsar + '.backup'); // Copy new app.asar to backup file (<new>/app.asar -> <new>/app.asar.backup)
fs.copyFileSync(cAsar, nAsar); // Copy old app.asar to new app.asar (<old>/app.asar -> <new>/app.asar)
} catch (e) {
log('Updater', 'Failed to retain OpenAsar', e);
}
app.once('will-quit', () => spawn(next, [], { app.once('will-quit', () => spawn(next, [], {
detached: true, detached: true,