de192c2db2
* chore: bump node in DEPS to v18.16.0 * build,test: add proper support for IBM i https://github.com/nodejs/node/pull/46739 * lib: enforce use of trailing commas https://github.com/nodejs/node/pull/46881 * src: add initial support for single executable applications https://github.com/nodejs/node/pull/45038 * lib: do not crash using workers with disabled shared array buffers https://github.com/nodejs/node/pull/41023 * src: remove shadowed variable in OptionsParser::Parse https://github.com/nodejs/node/pull/46672 * src: allow embedder control of code generation policy https://github.com/nodejs/node/pull/46368 * src: allow optional Isolate termination in node::Stop() https://github.com/nodejs/node/pull/46583 * lib: fix BroadcastChannel initialization location https://github.com/nodejs/node/pull/46864 * chore: fixup patch indices * chore: sync filenames.json * fix: add simdutf dep to src/inspector BUILD.gn - https://github.com/nodejs/node/pull/46471 - https://github.com/nodejs/node/pull/46472 * deps: replace url parser with Ada https://github.com/nodejs/node/pull/46410 * tls: support automatic DHE https://github.com/nodejs/node/pull/46978 * fixup! src: add initial support for single executable applications * http: unify header treatment https://github.com/nodejs/node/pull/46528 * fix: libc++ buffer overflow in string_view ctor https://github.com/nodejs/node/pull/46410 * test: include strace openat test https://github.com/nodejs/node/pull/46150 * fixup! fixup! src: add initial support for single executable applications --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
51 lines
2.1 KiB
Diff
51 lines
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: VerteDinde <keeleymhammond@gmail.com>
|
|
Date: Sun, 20 Nov 2022 21:45:20 -0800
|
|
Subject: fix: enable crashpad for ELECTRON_RUN_AS_NODE linux processes
|
|
|
|
Passes the crashpad handler PID and crashdump signal file descriptor
|
|
to child processes spawned with `ELECTRON_RUN_AS_NODE` which is used
|
|
by the crashpad client to connect with the handler process.
|
|
|
|
diff --git a/lib/child_process.js b/lib/child_process.js
|
|
index 07ad7906a7be156926d0c770c3d766c1a411203b..31061418c21d3764685110e827fc5ff536c74430 100644
|
|
--- a/lib/child_process.js
|
|
+++ b/lib/child_process.js
|
|
@@ -60,6 +60,7 @@ let debug = require('internal/util/debuglog').debuglog(
|
|
);
|
|
const { Buffer } = require('buffer');
|
|
const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap');
|
|
+const { getCrashdumpSignalFD, getCrashpadHandlerPID } = process._linkedBinding('electron_common_crashpad_support');
|
|
|
|
const {
|
|
AbortError,
|
|
@@ -163,7 +164,6 @@ function fork(modulePath, args = [], options) {
|
|
ArrayPrototypeSplice(execArgv, index - 1, 2);
|
|
}
|
|
}
|
|
-
|
|
args = [...execArgv, modulePath, ...args];
|
|
|
|
if (typeof options.stdio === 'string') {
|
|
@@ -625,6 +625,21 @@ function normalizeSpawnArguments(file, args, options) {
|
|
'options.windowsVerbatimArguments');
|
|
}
|
|
|
|
+ if (process.platform === 'linux') {
|
|
+ if (ObjectPrototypeHasOwnProperty(options.env || process.env, 'ELECTRON_RUN_AS_NODE') &&
|
|
+ (file === process.execPath)) {
|
|
+ // On Linux, pass the file descriptor which crashpad handler process
|
|
+ // uses to monitor the child process and PID of the handler process.
|
|
+ // https://source.chromium.org/chromium/chromium/src/+/110.0.5415.0:components/crash/core/app/crashpad_linux.cc;l=199-206
|
|
+ const fd = getCrashdumpSignalFD();
|
|
+ const pid = getCrashpadHandlerPID();
|
|
+ if (fd !== -1 && pid !== -1) {
|
|
+ options.env.CRASHDUMP_SIGNAL_FD = fd;
|
|
+ options.env.CRASHPAD_HANDLER_PID = pid;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
if (options.shell) {
|
|
validateArgumentNullCheck(options.shell, 'options.shell');
|
|
const command = ArrayPrototypeJoin([file, ...args], ' ');
|