[AsarUpdate] Handle write error without erroring fully

This commit is contained in:
Ducko 2021-12-11 19:51:14 +00:00
parent 70592854a8
commit d53177898a

View file

@ -25,6 +25,15 @@ module.exports = () => { // (Try) update asar
log('AsarUpdate', 'Original Hash:', originalHash); log('AsarUpdate', 'Original Hash:', originalHash);
const file = fs.createWriteStream(asarPath); const file = fs.createWriteStream(asarPath);
let writeError = false;
file.on('error', err => {
log('AsarUpdate', 'Failed to write', err);
file.close();
writeError = true;
});
log('AsarUpdate', 'Opened write stream to asar'); log('AsarUpdate', 'Opened write stream to asar');
request(asarUrl, (_err, res) => { request(asarUrl, (_err, res) => {
@ -61,5 +70,9 @@ Changed: ${changed}`);
electron.app.exit(); electron.app.exit();
} }
} }
if (writeError) {
// Warn message?
}
}); });
}; };