mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 15:27:17 +00:00
fix(GUI): prevent blank application when sending SIGINT (#1220)
This issue only affects GNU/Linux and macOS. If the user sends SIGINT to the application, the main process dies, but we get an orphaned blank browser window. The problem only seems to occur when there is a `beforeunload` window event handlers, which we use to warn the user when quitting while flashing. Change-Type: patch Changelog-Entry: Prevent blank application when sending SIGINT on GNU/Linux and macOS. Fixes: https://github.com/resin-io/etcher/issues/1028 Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This commit is contained in:
parent
724d47fb6a
commit
63dda89035
@ -19,10 +19,21 @@
|
||||
const electron = require('electron');
|
||||
const _ = require('lodash');
|
||||
const path = require('path');
|
||||
const EXIT_CODES = require('../shared/exit-codes');
|
||||
let mainWindow = null;
|
||||
|
||||
electron.app.on('window-all-closed', electron.app.quit);
|
||||
|
||||
// Sending a `SIGINT` (e.g: Ctrl-C) to an Electron app that registers
|
||||
// a `beforeunload` window event handler results in a disconnected white
|
||||
// browser window in GNU/Linux and macOS.
|
||||
// The `before-quit` Electron event is triggered in `SIGINT`, so we can
|
||||
// make use of it to ensure the browser window is completely destroyed.
|
||||
// See https://github.com/electron/electron/issues/5273
|
||||
electron.app.on('before-quit', () => {
|
||||
process.exit(EXIT_CODES.SUCCESS);
|
||||
});
|
||||
|
||||
electron.app.on('ready', () => {
|
||||
|
||||
// No menu bar
|
||||
|
Loading…
x
Reference in New Issue
Block a user