Skip to content

Commit

Permalink
fix: tests & quit click (#827)
Browse files Browse the repository at this point in the history
- Fixes possible edge-case where the Web UI window was already destroyed and we try to close it.
- Do not block quitting. This possibly fixes the tests and the #776 error. If the daemon happens to not exit correctly, we always do a cleanup when it starts

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
  • Loading branch information
hacdias committed Feb 17, 2019
1 parent d3d5e09 commit 589704c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/lib/register-daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
}
2 changes: 1 addition & 1 deletion src/lib/webui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 589704c

Please sign in to comment.