2013-11-24 12:45:12 +00:00
|
|
|
{spawn} = require 'child_process'
|
2013-11-14 05:33:09 +00:00
|
|
|
binding = process.atomBinding 'crash_reporter'
|
|
|
|
|
|
|
|
class CrashReporter
|
2013-11-15 03:00:48 +00:00
|
|
|
start: (options={}) ->
|
2013-11-18 10:27:50 +00:00
|
|
|
{productName, companyName, submitUrl, autoSubmit, ignoreSystemCrashHandler, extra} = options
|
2013-11-14 05:33:09 +00:00
|
|
|
|
2013-11-24 14:22:08 +00:00
|
|
|
productName ?= 'Atom-Shell'
|
2013-11-14 05:33:09 +00:00
|
|
|
companyName ?= 'GitHub, Inc'
|
2013-11-28 04:38:33 +00:00
|
|
|
submitUrl ?= 'http://54.249.141.255:1127/post'
|
2013-11-14 05:33:09 +00:00
|
|
|
autoSubmit ?= true
|
|
|
|
ignoreSystemCrashHandler ?= false
|
2013-11-18 10:27:50 +00:00
|
|
|
extra ?= {}
|
2013-11-14 05:33:09 +00:00
|
|
|
|
2013-11-26 02:19:50 +00:00
|
|
|
extra._productName ?= productName
|
|
|
|
extra._companyName ?= companyName
|
|
|
|
extra._version ?=
|
2014-05-21 14:44:43 +00:00
|
|
|
if process.type is 'browser'
|
2013-11-26 02:19:50 +00:00
|
|
|
require('app').getVersion()
|
|
|
|
else
|
|
|
|
require('remote').require('app').getVersion()
|
|
|
|
|
2013-11-24 14:22:08 +00:00
|
|
|
start = -> binding.start productName, companyName, submitUrl, autoSubmit, ignoreSystemCrashHandler, extra
|
|
|
|
|
2014-02-26 12:58:17 +00:00
|
|
|
if process.platform is 'win32'
|
2013-11-24 12:45:12 +00:00
|
|
|
args = [
|
2013-11-24 14:22:08 +00:00
|
|
|
"--reporter-url=#{submitUrl}"
|
2013-11-24 12:45:12 +00:00
|
|
|
"--application-name=#{productName}"
|
2013-11-24 14:22:08 +00:00
|
|
|
"--v=1"
|
2013-11-24 12:45:12 +00:00
|
|
|
]
|
|
|
|
env = ATOM_SHELL_INTERNAL_CRASH_SERVICE: 1
|
|
|
|
|
2013-11-24 14:22:08 +00:00
|
|
|
spawn process.execPath, args, {env, detached: true}
|
|
|
|
start()
|
2014-02-26 12:58:17 +00:00
|
|
|
else
|
|
|
|
start()
|
2013-11-14 05:33:09 +00:00
|
|
|
|
|
|
|
module.exports = new CrashReporter
|