mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
fix: enable crashpad for ELECTRON_RUN_AS_NODE processes (#36460)
* wip: enable crashpad for node processes
fix: add PID testing method
wip: plumb fd into child_process in node
* node::ProcessInitializationFlags::kNoDefaultSignalHandling
* chore: clean up debug logging
* chore: gate platform includes
* test: clean up node process test
* fix: pass pid in node_main
* chore: cleanup impl
* chore: fixup patch method definition
* fix: expose bound methods to node_main
* fix: remove bound methods
* fix: crashpad connection for all ELECTRON_RUN_AS_NODE processes
* chore: fix typo
* chore: address review feedback
* chore: delay crashpad initialization
* chore: ensure options.env, code hygiene
* chore: add argv test, check for process.env over {}
* fix: fix test, return options.env immutability
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
This commit is contained in:
6
spec/fixtures/apps/crash/fork.js
vendored
Normal file
6
spec/fixtures/apps/crash/fork.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
const path = require('path');
|
||||
const childProcess = require('child_process');
|
||||
|
||||
const crashPath = path.join(__dirname, 'node-crash.js');
|
||||
const child = childProcess.fork(crashPath, { silent: true });
|
||||
child.on('exit', () => process.exit(0));
|
||||
13
spec/fixtures/apps/crash/main.js
vendored
13
spec/fixtures/apps/crash/main.js
vendored
@@ -54,6 +54,19 @@ app.whenReady().then(() => {
|
||||
const crashPath = path.join(__dirname, 'node-crash.js');
|
||||
const child = childProcess.fork(crashPath, { silent: true });
|
||||
child.on('exit', () => process.exit(0));
|
||||
} else if (crashType === 'node-fork') {
|
||||
const scriptPath = path.join(__dirname, 'fork.js');
|
||||
const child = childProcess.fork(scriptPath, { silent: true });
|
||||
child.on('exit', () => process.exit(0));
|
||||
} else if (crashType === 'node-extra-args') {
|
||||
let exitcode = -1;
|
||||
const crashPath = path.join(__dirname, 'node-extra-args.js');
|
||||
const child = childProcess.fork(crashPath, ['--enable-logging'], { silent: true });
|
||||
child.send('message');
|
||||
child.on('message', (forkedArgs) => {
|
||||
if (JSON.stringify(forkedArgs) !== JSON.stringify(child.spawnargs)) { exitcode = 1; } else { exitcode = 0; }
|
||||
process.exit(exitcode);
|
||||
});
|
||||
} else {
|
||||
console.error(`Unrecognized crash type: '${crashType}'`);
|
||||
process.exit(1);
|
||||
|
||||
9
spec/fixtures/apps/crash/node-extra-args.js
vendored
Normal file
9
spec/fixtures/apps/crash/node-extra-args.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
const path = require('path');
|
||||
const childProcess = require('child_process');
|
||||
|
||||
process.on('message', function () {
|
||||
process.send(process.argv);
|
||||
});
|
||||
|
||||
// Allow time to send args, then crash the app.
|
||||
setTimeout(() => process.nextTick(() => process.crash()), 10000);
|
||||
Reference in New Issue
Block a user