From f530dfcc3ce02104029b7331344afbd73f113781 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Fri, 25 Mar 2016 09:41:30 -0400 Subject: [PATCH] Return to avoid any further code execution after an elevation error Turns out that even by using `process.exit(1)`, the electron main process doesn't exit instantly, but continues executing code. This causes electron to throw on `electron.globalShortcut` because this functionality is not available given that we didn't create a renderer view. Fixes: https://github.com/resin-io/etcher/issues/215 --- lib/etcher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/etcher.js b/lib/etcher.js index f02864bc..8bc8abb3 100644 --- a/lib/etcher.js +++ b/lib/etcher.js @@ -32,7 +32,7 @@ electron.app.on('ready', function() { if (error) { electron.dialog.showErrorBox('Elevation Error', error.message); - process.exit(1); + return process.exit(1); } mainWindow = new electron.BrowserWindow({