From 004282afb048d2d6a92e380ea6dbf9d7afd809bd Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 8 May 2020 08:14:57 +0200 Subject: [PATCH] diag - start crash reporter as early as possible if --crash-reporter-directory is used --- src/main.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main.js b/src/main.js index 9309c12a747..23915126b8f 100644 --- a/src/main.js +++ b/src/main.js @@ -35,6 +35,9 @@ app.setPath('userData', userDataPath); // Set temp directory based on crash-reporter-directory CLI argument // The crash reporter will store crashes in temp folder so we need // to change that location accordingly. + +// If a crash-reporter-directory is specified we setup the crash reporter +// right from the beginning as early as possible to monitor all processes. let crashReporterDirectory = args['crash-reporter-directory']; if (crashReporterDirectory) { crashReporterDirectory = path.normalize(crashReporterDirectory); @@ -47,8 +50,20 @@ if (crashReporterDirectory) { app.exit(1); } } + + // Crashes are stored in the temp directory by default, so we + // need to change that directory to the provided one console.log(`Found --crash-reporter-directory argument. Setting temp directory to be '${crashReporterDirectory}'`); app.setPath('temp', crashReporterDirectory); + + // Start crash reporter + const { crashReporter } = require('electron'); + crashReporter.start({ + companyName: 'Microsoft', + productName: product.nameShort, + submitURL: '', + uploadToServer: false + }); } // Set logs path before app 'ready' event if running portable