[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
1 changed files with 13 additions and 0 deletions

View File

@ -25,6 +25,15 @@ module.exports = () => { // (Try) update asar
log('AsarUpdate', 'Original Hash:', originalHash);
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');
request(asarUrl, (_err, res) => {
@ -61,5 +70,9 @@ Changed: ${changed}`);
electron.app.exit();
}
}
if (writeError) {
// Warn message?
}
});
};