diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-02-01 03:00:23 +0300 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2019-02-06 07:36:35 +0300 |
commit | eb68619f951fb3c3a77cd7afb029e75d221e886d (patch) | |
tree | 19a60c9dc17cfb792b4cc0b1dacedb3fa10609b4 /src/node_process_methods.cc | |
parent | d3ea63921f834d46b13e72a344d8c24833dc75d5 (diff) |
src: move process.reallyExit impl into node_process_methods.cc
Because the part that is shared by `process.reallyExit` and the
Node.js teardown is `WaitForInspectorDisconnect()`, move that
into node_internals.h instead, and move the C++ binding code
into `node_process_methods.cc` since that's the only place
it's needed.
PR-URL: https://github.com/nodejs/node/pull/25860
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'src/node_process_methods.cc')
-rw-r--r-- | src/node_process_methods.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index a6d2c252e77..be91a11f566 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -385,6 +385,13 @@ static void DebugEnd(const FunctionCallbackInfo<Value>& args) { #endif } +static void ReallyExit(const FunctionCallbackInfo<Value>& args) { + Environment* env = Environment::GetCurrent(args); + WaitForInspectorDisconnect(env); + int code = args[0]->Int32Value(env->context()).FromMaybe(0); + env->Exit(code); +} + static void InitializeProcessMethods(Local<Object> target, Local<Value> unused, Local<Context> context, @@ -416,7 +423,7 @@ static void InitializeProcessMethods(Local<Object> target, env->SetMethodNoSideEffect(target, "cwd", Cwd); env->SetMethod(target, "dlopen", binding::DLOpen); - env->SetMethod(target, "reallyExit", Exit); + env->SetMethod(target, "reallyExit", ReallyExit); env->SetMethodNoSideEffect(target, "uptime", Uptime); } |