src: don't run tasks on isolate termination

Fixes: https://github.com/nodejs/node/issues/45419
PR-URL: https://github.com/nodejs/node/pull/45444
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Santiago Gimeno authored and Danielle Adams committed 2023-01-03 08:38:51 -05:00
1 parent 9c39b5ec48
commit 2c6a4fd6fa
1 file changed
+1 -1
+1 -1
View File
@@ -406,7 +406,7 @@ int NodePlatform::NumberOfWorkerThreads() {
}
void PerIsolatePlatformData::RunForegroundTask(std::unique_ptr<Task> task) {
if (isolate_->IsExecutionTerminating()) return task->Run();
if (isolate_->IsExecutionTerminating()) return;
DebugSealHandleScope scope(isolate_);
Environment* env = Environment::GetCurrent(isolate_);
if (env != nullptr) {