Skip to content

Commit

Permalink
report: use triggerReport() to handle signals
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
cjihrig authored and BridgeAR committed Mar 4, 2019
1 parent b216f44 commit 0579f42
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
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

0 comments on commit 0579f42

Please sign in to comment.