Skip to content

Commit

Permalink
Merge pull request #40 from yahoo/node12
Browse files Browse the repository at this point in the history
Added support for node v12
  • Loading branch information
sylvio authored Jul 9, 2019
2 parents 38849c3 + 303ac8d commit c22082e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ addons:
- g++-4.9
env: CXX=g++-4.9 CC=gcc-4.9
node_js:
- "4"
- "6"
- "8"
- "10"
- "12"
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{
"name": "monitr",
"description": "Node process monitoring tool",
"version": "1.1.0",
"version": "1.2.0",
"author": "Rohini Harendra <[email protected]>",
"contributors": [
{
"name": "ET",
"email": "[email protected]"
},
{
"name": "Sylvio Marcondes",
"email": "[email protected]"
}
],
"os": [
Expand Down
18 changes: 12 additions & 6 deletions src/monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,15 @@ static void Interrupter(v8::Isolate* isolate, void *data) {

fprintf(stderr, "Interrupted: (frames: %d of %d)\n", std::min(frameCount, kMaxFrames), frameCount);
for (int i = 0; i < stack->GetFrameCount(); ++i ) {
v8::Local<StackFrame> frame = stack->GetFrame( i );
v8::Local<StackFrame> frame = stack->GetFrame(
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION >= 7)
isolate,
#endif
i );
int line = frame->GetLineNumber();
int col = frame->GetColumn();
v8::String::Utf8Value fn(frame->GetFunctionName());
v8::String::Utf8Value script(frame->GetScriptName());
Nan::Utf8String fn(frame->GetFunctionName());
Nan::Utf8String script(frame->GetScriptName());

fprintf(stderr, " at %s (%s:%d:%d)\n",
fn.length() == 0 ? "<anonymous>" : *fn, *script, line, col);
Expand Down Expand Up @@ -667,7 +671,8 @@ int NodeMonitor::getIntFunction(const char* funcName) {
Nan::HandleScope scope;
Local<Value> res = callFunction(funcName);
if (res->IsNumber()) {
return res->Uint32Value();
uint32_t value = res->Uint32Value(Nan::GetCurrentContext()).FromJust();
return value;
}
return 0;
}
Expand All @@ -677,7 +682,8 @@ bool NodeMonitor::getBooleanFunction(const char* funcName) {
Nan::HandleScope scope;
Local<Value> res = callFunction(funcName);
if (res->IsBoolean()) {
return res->BooleanValue();
bool value = res->BooleanValue(Nan::GetCurrentContext()).FromJust();
return value;
}
return false;
}
Expand Down Expand Up @@ -949,7 +955,7 @@ static NAN_METHOD(SetterIPCMonitorPath) {
(!info[0]->IsString() && !info[0]->IsUndefined() && !info[0]->IsNull())) {
THROW_BAD_ARGS();
}
String::Utf8Value ipcMonitorPath(info[0]);
Nan::Utf8String ipcMonitorPath(info[0]);
_ipcMonitorPath = *ipcMonitorPath;
}

Expand Down

0 comments on commit c22082e

Please sign in to comment.