backups: fix app restore with tgz

This commit is contained in:
Girish Ramakrishnan
2025-07-25 12:55:14 +02:00
parent 83ab701d02
commit fc4da4408c
5 changed files with 43 additions and 32 deletions

View File

@@ -70,6 +70,7 @@ async function setupNetworking() {
// 50 - internal error , 70 - SIGTERM exit
function exitSync(status) {
if (status.error) fs.write(logFd, status.error.stack + '\n', function () {});
fs.write(logFd, `Exiting with code ${status.code}\n`, function () {});
fs.fsyncSync(logFd);
fs.closeSync(logFd);
process.exit(status.code);
@@ -127,10 +128,11 @@ async function main() {
percent: 100
};
await safe(tasks.setCompleted(taskId, progress), { debug });
debug(`Task took ${(new Date() - startTime)/1000} seconds`);
await safe(tasks.setCompleted(taskId, progress), { debug });
exitSync({ error: runError, code: runError instanceof BoxError ? 0 : 50 }); // handled error vs run time crash
exitSync({ error: runError, code: (!runError || runError instanceof BoxError) ? 0 : 50 }); // handled error vs run time crash
}
main();