Emit process exit event with app exit code

This commit is contained in:
Kevin Sawicki 2015-12-07 16:45:49 -08:00
parent d2e63dfc64
commit 63c0095efb
3 changed files with 13 additions and 7 deletions

View file

@ -34,6 +34,18 @@ app.setAppPath = (path) ->
app.getAppPath = ->
appPath
appExitCode = undefined
app.exit = (exitCode) ->
appExitCode = exitCode
app._exit(exitCode)
# Map process.exit to app.exit, which quits gracefully.
process.exit = app.exit
# Emit a process 'exit' event on app quit.
app.on 'quit', ->
process.emit 'exit', appExitCode
# Routes the events to webContents.
for name in ['login', 'certificate-error', 'select-client-certificate']
do (name) ->