mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fixed app termination after unsuccessful migration for electron
This commit is contained in:
parent
1ee8d9fd93
commit
48684d0509
@ -4,6 +4,7 @@ const sqlInit = require('./sql_init');
|
||||
const optionService = require('./options');
|
||||
const fs = require('fs-extra');
|
||||
const log = require('./log');
|
||||
const utils = require('./utils');
|
||||
const resourceDir = require('./resource_dir');
|
||||
|
||||
async function migrate() {
|
||||
@ -72,7 +73,7 @@ async function migrate() {
|
||||
log.error("error during migration to version " + mig.dbVersion + ": " + e.stack);
|
||||
log.error("migration failed, crashing hard"); // this is not very user friendly :-/
|
||||
|
||||
process.exit(1);
|
||||
utils.crash();
|
||||
}
|
||||
finally {
|
||||
// make sure foreign keys are enabled even if migration script disables them
|
||||
|
@ -118,6 +118,15 @@ function escapeRegExp(str) {
|
||||
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
|
||||
}
|
||||
|
||||
function crash() {
|
||||
if (isElectron()) {
|
||||
require('electron').app.exit(1);
|
||||
}
|
||||
else {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
randomSecureToken,
|
||||
randomString,
|
||||
@ -137,5 +146,6 @@ module.exports = {
|
||||
stripTags,
|
||||
intersection,
|
||||
union,
|
||||
escapeRegExp
|
||||
escapeRegExp,
|
||||
crash
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user