Merge pull request #8430 from ramya-rao-a/crash-for-children-docs
Updated docs for crash reporter to support child processes
This commit is contained in:
commit
90470617ab
1 changed files with 25 additions and 6 deletions
|
@ -51,16 +51,35 @@ You are required to call this method before using any other `crashReporter` APIs
|
||||||
and in each process (main/renderer) from which you want to collect crash reports.
|
and in each process (main/renderer) from which you want to collect crash reports.
|
||||||
You can pass different options to `crashReporter.start` when calling from different processes.
|
You can pass different options to `crashReporter.start` when calling from different processes.
|
||||||
|
|
||||||
**Note:** On Windows and Linux, Electron uses `breakpad` for crash collection and reporting.
|
**Note** Child processes created via the `child_process` module will not have access to the Electron modules.
|
||||||
Crashes can be collected from the main and renderer process, but not from the child processes
|
Therefore, to collect crash reports from them, use `process.crashReporter.start` instead. Pass the same options as above
|
||||||
created via the `child_process` module.
|
along with an additional one called `crashesDirectory` that should point to a directory to store the crash
|
||||||
|
reports temporarily. You can test this out by calling `process.crash()` to crash the child process.
|
||||||
|
|
||||||
|
**Note:** To collect crash reports from child process in Windows, you need to add this extra code as well.
|
||||||
|
This will start the process that will monitor and send the crash reports. Replace `submitURL`, `productName`
|
||||||
|
and `crashesDirectory` with appropriate values.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const args = [
|
||||||
|
`--reporter-url=${submitURL}`,
|
||||||
|
`--application-name=${productName}`,
|
||||||
|
`--crashes-directory=${crashesDirectory}`
|
||||||
|
]
|
||||||
|
const env = {
|
||||||
|
ELECTRON_INTERNAL_CRASH_SERVICE: 1
|
||||||
|
}
|
||||||
|
spawn(process.execPath, args, {
|
||||||
|
env: env,
|
||||||
|
detached: true
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
**Note:** On macOS, Electron uses a new `crashpad` client for crash collection and reporting.
|
**Note:** On macOS, Electron uses a new `crashpad` client for crash collection and reporting.
|
||||||
Crashes can be collected from the main, renderer and any of the child processes created via the `child_process` module.
|
|
||||||
If you want to enable crash reporting, initializing `crashpad` from the main process using `crashReporter.start` is required
|
If you want to enable crash reporting, initializing `crashpad` from the main process using `crashReporter.start` is required
|
||||||
regardless of which process you want to collect crashes from. Once initialized this way, the crashpad handler collects
|
regardless of which process you want to collect crashes from. Once initialized this way, the crashpad handler collects
|
||||||
crashes from all processes. You still have to call `crashReporter.start` from the renderer process, otherwise crashes from
|
crashes from all processes. You still have to call `crashReporter.start` from the renderer or child process, otherwise crashes from
|
||||||
renderer processes will get reported without `companyName`, `productName` or any of the `extra` information.
|
them will get reported without `companyName`, `productName` or any of the `extra` information.
|
||||||
|
|
||||||
### `crashReporter.getLastCrashReport()`
|
### `crashReporter.getLastCrashReport()`
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue