Skip to content

Commit 0579f42

Browse files
cjihrigBridgeAR
authored andcommitted
report: use triggerReport() to handle signals
This commit uses the triggerReport() binding to handle signals and removes the custom onUserSignal() function. PR-URL: #26386 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent b216f44 commit 0579f42

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

lib/internal/process/report.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const report = {
104104
function handleSignal(signo) {
105105
if (typeof signo !== 'string')
106106
signo = config.signal;
107-
nr.onUserSignal(signo);
107+
nr.triggerReport(signo, 'Signal', null, '');
108108
}
109109

110110
module.exports = {

src/node_report.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ static void PrintJavaScriptStack(JSONWriter* writer,
377377

378378
std::string ss;
379379
if ((!strcmp(location, "OnFatalError")) ||
380-
(!strcmp(location, "OnUserSignal"))) {
380+
(!strcmp(location, "Signal"))) {
381381
ss = "No stack.\nUnavailable.\n";
382382
} else {
383383
String::Utf8Value sv(isolate, stackstr);

src/node_report_module.cc

-13
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,6 @@ void GetReport(const FunctionCallbackInfo<Value>& info) {
7575
.ToLocalChecked());
7676
}
7777

78-
// Signal handler for report action, called from JS land (util.js)
79-
void OnUserSignal(const FunctionCallbackInfo<Value>& info) {
80-
Environment* env = Environment::GetCurrent(info);
81-
Isolate* isolate = env->isolate();
82-
CHECK(info[0]->IsString());
83-
Local<String> str = info[0].As<String>();
84-
String::Utf8Value value(isolate, str);
85-
std::string filename;
86-
TriggerNodeReport(
87-
isolate, env, *value, __func__, filename, info[0].As<String>());
88-
}
89-
9078
// A method to sync up data elements in the JS land with its
9179
// corresponding elements in the C++ world. Required because
9280
// (i) the tunables are first intercepted through the CLI but
@@ -219,7 +207,6 @@ static void Initialize(Local<Object> exports,
219207
std::shared_ptr<PerIsolateOptions> options = env->isolate_data()->options();
220208
env->SetMethod(exports, "triggerReport", TriggerReport);
221209
env->SetMethod(exports, "getReport", GetReport);
222-
env->SetMethod(exports, "onUserSignal", OnUserSignal);
223210
env->SetMethod(exports, "syncConfig", SyncConfig);
224211
}
225212

0 commit comments

Comments
 (0)