Skip to content

Commit

Permalink
src: disallow JS execution during exit()
Browse files Browse the repository at this point in the history
This is just an extra safeguard – no JS should run once we’ve
decided that we are going to shutdown the process, but we’re opening
a handle scope in order to access V8, so make sure that our operations
do not lead to JS accidentally being run.

PR-URL: #35020
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
  • Loading branch information
addaleax committed Sep 22, 2020
1 parent 3e91519 commit ae800da
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,8 @@ uv_key_t Environment::thread_local_env = {};
void Environment::Exit(int exit_code) {
if (options()->trace_exit) {
HandleScope handle_scope(isolate());
Isolate::DisallowJavascriptExecutionScope disallow_js(
isolate(), Isolate::DisallowJavascriptExecutionScope::CRASH_ON_FAILURE);

if (is_main_thread()) {
fprintf(stderr, "(node:%d) ", uv_os_getpid());
Expand Down

0 comments on commit ae800da

Please sign in to comment.