summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-02-01 08:00:23 +0800
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-02-06 05:36:35 +0100
commiteb68619f951fb3c3a77cd7afb029e75d221e886d (patch)
tree19a60c9dc17cfb792b4cc0b1dacedb3fa10609b4 /src
parentd3ea63921f834d46b13e72a344d8c24833dc75d5 (diff)
downloadandroid-node-v8-eb68619f951fb3c3a77cd7afb029e75d221e886d.tar.gz
android-node-v8-eb68619f951fb3c3a77cd7afb029e75d221e886d.tar.bz2
android-node-v8-eb68619f951fb3c3a77cd7afb029e75d221e886d.zip
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')
-rw-r--r--src/node.cc10
-rw-r--r--src/node_internals.h2
-rw-r--r--src/node_process_methods.cc9
3 files changed, 10 insertions, 11 deletions
diff --git a/src/node.cc b/src/node.cc
index 20206b8199..dfd691facd 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -118,7 +118,6 @@ using v8::Exception;
using v8::Function;
using v8::FunctionCallbackInfo;
using v8::HandleScope;
-using v8::Int32;
using v8::Isolate;
using v8::Just;
using v8::Local;
@@ -158,7 +157,7 @@ struct V8Platform v8_platform;
static const unsigned kMaxSignal = 32;
#endif
-static void WaitForInspectorDisconnect(Environment* env) {
+void WaitForInspectorDisconnect(Environment* env) {
#if HAVE_INSPECTOR
if (env->inspector_agent()->IsActive()) {
// Restore signal dispositions, the app is done and is no longer
@@ -178,13 +177,6 @@ static void WaitForInspectorDisconnect(Environment* env) {
#endif
}
-void Exit(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args);
- WaitForInspectorDisconnect(env);
- int code = args[0]->Int32Value(env->context()).FromMaybe(0);
- env->Exit(code);
-}
-
void SignalExit(int signo) {
uv_tty_reset_mode();
#ifdef __FreeBSD__
diff --git a/src/node_internals.h b/src/node_internals.h
index b34e6f90e7..c94be6ebe9 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -86,7 +86,7 @@ void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(err);
}
-void Exit(const v8::FunctionCallbackInfo<v8::Value>& args);
+void WaitForInspectorDisconnect(Environment* env);
void SignalExit(int signo);
#ifdef __POSIX__
void RegisterSignalHandler(int signal,
diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc
index a6d2c252e7..be91a11f56 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);
}