diff --git a/src/lib/register-daemon.js b/src/lib/register-daemon.js index 02fa55781..354125dc9 100644 --- a/src/lib/register-daemon.js +++ b/src/lib/register-daemon.js @@ -54,11 +54,9 @@ export default async function (ctx) { await ctx.startIpfs() - app.once('will-quit', async (event) => { - event.preventDefault() + app.on('before-quit', async () => { logger.info('[ipfsd] stopping daemon') await ctx.stopIpfs() logger.info('[ipfsd] daemon stopped') - app.quit() }) } diff --git a/src/lib/webui/index.js b/src/lib/webui/index.js index a8e22ddaf..0a118300a 100644 --- a/src/lib/webui/index.js +++ b/src/lib/webui/index.js @@ -72,7 +72,7 @@ export default async function (ctx) { app.on('before-quit', () => { // Makes sure the app quits even though we prevent // the closing of this window. - window.destroy() + if (window) window.destroy() }) ipcMain.on('config.get', () => {