mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
server-esm: Make crash async
This commit is contained in:
parent
8a30663d1e
commit
013f25a49b
@ -20,7 +20,7 @@ async function migrate() {
|
||||
if (currentDbVersion < 214) {
|
||||
log.error("Direct migration from your current version is not supported. Please upgrade to the latest v0.60.4 first and only then to this version.");
|
||||
|
||||
utils.crash();
|
||||
await utils.crash();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ async function migrate() {
|
||||
log.error("migration failed, crashing hard"); // this is not very user-friendly :-/
|
||||
|
||||
utils.crash();
|
||||
break; // crash() above does not seem to work right away
|
||||
break; // crash() is sometimes async
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -135,7 +135,7 @@ async function migrateIfNecessary() {
|
||||
if (currentDbVersion > appInfo.dbVersion && process.env.TRILIUM_IGNORE_DB_VERSION !== 'true') {
|
||||
log.error(`Current DB version ${currentDbVersion} is newer than the current DB version ${appInfo.dbVersion}, which means that it was created by a newer and incompatible version of Trilium. Upgrade to the latest version of Trilium to resolve this issue.`);
|
||||
|
||||
utils.crash();
|
||||
await utils.crash();
|
||||
}
|
||||
|
||||
if (!isDbUpToDate()) {
|
||||
|
@ -125,11 +125,10 @@ function escapeRegExp(str: string) {
|
||||
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
|
||||
}
|
||||
|
||||
function crash() {
|
||||
async function crash() {
|
||||
if (isElectron()) {
|
||||
require('electron').app.exit(1);
|
||||
}
|
||||
else {
|
||||
(await import("electron")).app.exit(1);
|
||||
} else {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user