From 57a003d7c59913ecf007245709a407df1c4f6418 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 15 Jul 2020 19:44:34 -0700 Subject: [PATCH] electron 10 crash reporter changes Crash reporter doesn't need to be started in child processes, and in fact the functions are all deprecated. Instead start it from the main process, and the child processes will automatically be covered Change of params to crashReporter.start() function --- src/crash-reporter.js | 5 +++-- src/main/index.js | 9 ++++----- src/renderer/main.js | 3 --- src/renderer/webtorrent.js | 4 ---- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/crash-reporter.js b/src/crash-reporter.js index 8fd2ac15..baa806ac 100644 --- a/src/crash-reporter.js +++ b/src/crash-reporter.js @@ -7,8 +7,9 @@ function init () { const electron = require('electron') electron.crashReporter.start({ - companyName: config.APP_NAME, productName: config.APP_NAME, - submitURL: config.CRASH_REPORT_URL + submitURL: config.CRASH_REPORT_URL, + globalExtra: { _companyName: config.APP_NAME }, + compress: true }) } diff --git a/src/main/index.js b/src/main/index.js index d670caba..e2fb125b 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -3,10 +3,13 @@ console.time('init') const electron = require('electron') const app = electron.app +// Start crash reporter early, so it takes effect for child processes +const crashReporter = require('../crash-reporter') +crashReporter.init() + const parallel = require('run-parallel') const config = require('../config') -const crashReporter = require('../crash-reporter') const ipc = require('./ipc') const log = require('./log') const menu = require('./menu') @@ -109,10 +112,6 @@ function init () { ipc.init() - app.once('will-finish-launching', function () { - crashReporter.init() - }) - app.once('ipcReady', function () { log('Command line args:', argv) processArgv(argv) diff --git a/src/renderer/main.js b/src/renderer/main.js index 7592dc0d..3ceecdc8 100644 --- a/src/renderer/main.js +++ b/src/renderer/main.js @@ -14,9 +14,6 @@ Module.prototype.require = function (id) { console.time('init') -const crashReporter = require('../crash-reporter') -crashReporter.init() - // Perf optimization: Start asynchronously read on config file before all the // blocking require() calls below. diff --git a/src/renderer/webtorrent.js b/src/renderer/webtorrent.js index f61d4776..46630858 100644 --- a/src/renderer/webtorrent.js +++ b/src/renderer/webtorrent.js @@ -12,14 +12,10 @@ const networkAddress = require('network-address') const path = require('path') const WebTorrent = require('webtorrent') -const crashReporter = require('../crash-reporter') const config = require('../config') const { TorrentKeyNotFoundError } = require('./lib/errors') const torrentPoster = require('./lib/torrent-poster') -// Report when the process crashes -crashReporter.init() - // Send & receive messages from the main window const ipc = electron.ipcRenderer