Skip to content

Commit 004282a

Browse files
author
Benjamin Pasero
committed
diag - start crash reporter as early as possible if --crash-reporter-directory is used
1 parent 7653d83 commit 004282a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/main.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ app.setPath('userData', userDataPath);
3535
// Set temp directory based on crash-reporter-directory CLI argument
3636
// The crash reporter will store crashes in temp folder so we need
3737
// to change that location accordingly.
38+
39+
// If a crash-reporter-directory is specified we setup the crash reporter
40+
// right from the beginning as early as possible to monitor all processes.
3841
let crashReporterDirectory = args['crash-reporter-directory'];
3942
if (crashReporterDirectory) {
4043
crashReporterDirectory = path.normalize(crashReporterDirectory);
@@ -47,8 +50,20 @@ if (crashReporterDirectory) {
4750
app.exit(1);
4851
}
4952
}
53+
54+
// Crashes are stored in the temp directory by default, so we
55+
// need to change that directory to the provided one
5056
console.log(`Found --crash-reporter-directory argument. Setting temp directory to be '${crashReporterDirectory}'`);
5157
app.setPath('temp', crashReporterDirectory);
58+
59+
// Start crash reporter
60+
const { crashReporter } = require('electron');
61+
crashReporter.start({
62+
companyName: 'Microsoft',
63+
productName: product.nameShort,
64+
submitURL: '',
65+
uploadToServer: false
66+
});
5267
}
5368

5469
// Set logs path before app 'ready' event if running portable

0 commit comments

Comments
 (0)