CrashReporter should not run on UI thread on Win/Linux

This commit is contained in:
Damien Guard
2016-06-27 16:31:01 -07:00
parent 3fd0d301be
commit 22922dec96
4 changed files with 24 additions and 17 deletions

View File

@@ -0,0 +1,13 @@
module.exports = (extra) ->
# Breakpad on Mac OS X must be running on UI and non-UI processes
# Crashpad on Windows and Linux should only be running on non-UI process
return if process.type is 'renderer' and process.platform isnt 'darwin'
{crashReporter} = require 'electron'
crashReporter.start({
productName: 'Atom',
companyName: 'GitHub',
submitURL: 'http://54.249.141.255:1127/post'
extra: extra
})

View File

@@ -4,9 +4,10 @@ cloneObject = (object) ->
clone
module.exports = ({blobStore}) ->
{crashReporter, remote} = require 'electron'
# Start the crash reporter before anything else.
crashReporter.start(productName: 'Atom', companyName: 'GitHub', submitURL: 'http://54.249.141.255:1127/post')
startCrashReporter = require('./crash-reporter-start')
{remote} = require 'electron'
startCrashReporter() # Before anything else
exitWithStatusCode = (status) ->
remote.app.emit('will-quit')

View File

@@ -4,12 +4,13 @@ process.on 'uncaughtException', (error={}) ->
console.log(error.message) if error.message?
console.log(error.stack) if error.stack?
{crashReporter, app} = require 'electron'
{app} = require 'electron'
fs = require 'fs-plus'
path = require 'path'
temp = require 'temp'
yargs = require 'yargs'
previousConsoleLog = console.log
startCrashReporter = require('../crash-reporter-start')
console.log = require 'nslog'
start = ->
@@ -38,7 +39,7 @@ start = ->
app.on 'open-file', addPathToOpen
app.on 'open-url', addUrlToOpen
app.on 'will-finish-launching', setupCrashReporter
app.on 'will-finish-launching', startCrashReporter
if args.userDataDir?
app.setPath('userData', args.userDataDir)
@@ -66,9 +67,6 @@ handleStartupEventWithSquirrel = ->
squirrelCommand = process.argv[1]
SquirrelUpdate.handleStartupEvent(app, squirrelCommand)
setupCrashReporter = ->
crashReporter.start(productName: 'Atom', companyName: 'GitHub', submitURL: 'http://54.249.141.255:1127/post')
setupAtomHome = ({setPortable}) ->
return if process.env.ATOM_HOME

View File

@@ -70,15 +70,10 @@
ModuleCache.register(loadSettings)
ModuleCache.add(loadSettings.resourcePath)
// Start the crash reporter before anything else.
require('electron').crashReporter.start({
productName: 'Atom',
companyName: 'GitHub',
submitURL: 'http://54.249.141.255:1127/post',
// By explicitly passing the app version here, we could save the call
// of "require('remote').require('app').getVersion()".
extra: {_version: loadSettings.appVersion}
})
// By explicitly passing the app version here, we could save the call
// of "require('remote').require('app').getVersion()".
var startCrashReporter = require('../src/crash-reporter-start')
startCrashReporter({_version: loadSettings.appVersion})
setupVmCompatibility()
setupCsonCache(CompileCache.getCacheDirectory())