diff --git a/src/main/index.ts b/src/main/index.ts index e401eee..12711bb 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -68,26 +68,20 @@ async function fixUserDataPermissions(): Promise { let quitTimeout: NodeJS.Timeout | null = null export let mainWindow: BrowserWindow | null = null +const gotTheLock = app.requestSingleInstanceLock() + +if (!gotTheLock) { + app.quit() +} async function initApp(): Promise { await fixUserDataPermissions() } initApp() - .then(() => { - const gotTheLock = app.requestSingleInstanceLock() - - if (!gotTheLock) { - app.quit() - } - }) - .catch(() => { - // ignore permission fix errors - const gotTheLock = app.requestSingleInstanceLock() - - if (!gotTheLock) { - app.quit() - } + .catch((e) => { + showSafeErrorBox('common.error.initFailed', `${e}`) + app.quit() }) export function customRelaunch(): void {