Properly exit when render process crashes if exitWhenDone option is true

Previously, we were referring to an undefined `atom` global to exit when
the render process crashed in specs. Now we only exit when exitWhenDone
is true, which will only exit in headless specs. Also, we now call .exit
on an object that's actually defined.
This commit is contained in:
Nathan Sobo
2014-01-07 19:19:42 -07:00
parent 17947d0f99
commit eab26fb3a6
2 changed files with 4 additions and 2 deletions

View File

@@ -52,6 +52,8 @@ class AtomApplication
resourcePath: null
version: null
exit: (status) -> app.exit(status)
constructor: (options) ->
{@resourcePath, @version, @devMode} = options
global.atomApplication = this

View File

@@ -18,7 +18,7 @@ class AtomWindow
isSpec: null
constructor: (settings={}) ->
{@resourcePath, pathToOpen, initialLine, @isSpec} = settings
{@resourcePath, pathToOpen, initialLine, @isSpec, @exitWhenDone} = settings
global.atomApplication.addWindow(this)
@setupNodePath(@resourcePath)
@@ -82,7 +82,7 @@ class AtomWindow
@browserWindow.destroy() if chosen is 0
@browserWindow.on 'crashed', =>
atom.exit(100) if @isSpec
global.atomApplication.exit(100) if @exitWhenDone
chosen = dialog.showMessageBox @browserWindow,
type: 'warning'