summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-01-12 21:28:48 +0100
committerJoyee Cheung <joyeec9h3@gmail.com>2019-01-16 22:58:16 +0800
commit8528c21188d748c0caebd22bd4673bad53476866 (patch)
tree45e44d5a76d620b9f6cd611f14517b53eab38947
parent84e90decd508afc2e2d53b475258ae4ec36ea586 (diff)
downloadandroid-node-v8-8528c21188d748c0caebd22bd4673bad53476866.tar.gz
android-node-v8-8528c21188d748c0caebd22bd4673bad53476866.tar.bz2
android-node-v8-8528c21188d748c0caebd22bd4673bad53476866.zip
src: call `Environment::Exit()` for fatal exceptions
Call `Environment::Exit()` rather than the process-wide `exit()` function, since JS exceptions generally only affect the current JS engine instance. PR-URL: https://github.com/nodejs/node/pull/25472 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
-rw-r--r--src/node_errors.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/node_errors.cc b/src/node_errors.cc
index 2a86c7402b..9b55a0b921 100644
--- a/src/node_errors.cc
+++ b/src/node_errors.cc
@@ -324,7 +324,7 @@ TryCatchScope::~TryCatchScope() {
if (HasCaught() && !HasTerminated() && mode_ == CatchMode::kFatal) {
HandleScope scope(env_->isolate());
ReportException(env_, Exception(), Message());
- exit(7);
+ env_->Exit(7);
}
}
@@ -711,7 +711,7 @@ void FatalException(Isolate* isolate,
// Failed before the process._fatalException function was added!
// this is probably pretty bad. Nothing to do but report and exit.
ReportException(env, error, message);
- exit(6);
+ env->Exit(6);
} else {
errors::TryCatchScope fatal_try_catch(env);
@@ -727,7 +727,7 @@ void FatalException(Isolate* isolate,
if (fatal_try_catch.HasCaught()) {
// The fatal exception function threw, so we must exit
ReportException(env, fatal_try_catch);
- exit(7);
+ env->Exit(7);
} else if (caught.ToLocalChecked()->IsFalse()) {
ReportException(env, error, message);
@@ -738,9 +738,9 @@ void FatalException(Isolate* isolate,
Local<Value> code;
if (!process_object->Get(env->context(), exit_code).ToLocal(&code) ||
!code->IsInt32()) {
- exit(1);
+ env->Exit(1);
}
- exit(code.As<Int32>()->Value());
+ env->Exit(code.As<Int32>()->Value());
}
}
}