From 3ef36a4817c5679d054ae3da7fc431fe014b8c6d Mon Sep 17 00:00:00 2001 From: bridiver Date: Fri, 9 Jun 2017 16:18:27 -0700 Subject: [PATCH] handle exit signals cleanly possible fix for #9373 --- app/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/index.js b/app/index.js index d0fb8988ee2..d4435a7f2ed 100644 --- a/app/index.js +++ b/app/index.js @@ -195,6 +195,13 @@ const initiateSessionStateSave = () => { }) } +// exit cleanly on signals +['SIGTERM', 'SIGHUP', 'SIGINT', 'SIGBREAK'].forEach((signal) => { + process.on(signal, () => { + app.quit() + }) +}) + let loadAppStatePromise = SessionStore.loadAppState() // Some settings must be set right away on startup, those settings should be handled here.