Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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 <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
cjihrig committed Mar 4, 2019
commit b271b0315a2ecec3cd1aae0c5556a31f5911dcec
2 changes: 1 addition & 1 deletion lib/internal/process/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const report = {
function handleSignal(signo) {
if (typeof signo !== 'string')
signo = config.signal;
nr.onUserSignal(signo);
nr.triggerReport(signo, 'Signal', null, '');
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ static void PrintJavaScriptStack(JSONWriter* writer,

std::string ss;
if ((!strcmp(location, "OnFatalError")) ||
(!strcmp(location, "OnUserSignal"))) {
(!strcmp(location, "Signal"))) {
ss = "No stack.\nUnavailable.\n";
} else {
String::Utf8Value sv(isolate, stackstr);
Expand Down
13 changes: 0 additions & 13 deletions src/node_report_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,6 @@ void GetReport(const FunctionCallbackInfo<Value>& info) {
.ToLocalChecked());
}

// Signal handler for report action, called from JS land (util.js)
void OnUserSignal(const FunctionCallbackInfo<Value>& info) {
Environment* env = Environment::GetCurrent(info);
Isolate* isolate = env->isolate();
CHECK(info[0]->IsString());
Local<String> str = info[0].As<String>();
String::Utf8Value value(isolate, str);
std::string filename;
TriggerNodeReport(
isolate, env, *value, __func__, filename, info[0].As<String>());
}

// A method to sync up data elements in the JS land with its
// corresponding elements in the C++ world. Required because
// (i) the tunables are first intercepted through the CLI but
Expand Down Expand Up @@ -219,7 +207,6 @@ static void Initialize(Local<Object> exports,
std::shared_ptr<PerIsolateOptions> options = env->isolate_data()->options();
env->SetMethod(exports, "triggerReport", TriggerReport);
env->SetMethod(exports, "getReport", GetReport);
env->SetMethod(exports, "onUserSignal", OnUserSignal);
env->SetMethod(exports, "syncConfig", SyncConfig);
}

Expand Down