From 8cdeef5815aa1485fbe7ff6abdf0c820efb04181 Mon Sep 17 00:00:00 2001 From: Daeyeon Jeong Date: Fri, 5 Jul 2024 23:01:02 +0900 Subject: [PATCH] fixup! src: fix Worker termination when '--inspect-brk' is passed Signed-off-by: Daeyeon Jeong --- src/env.h | 2 +- src/inspector_agent.cc | 3 ++- src/node.cc | 4 ++-- src/node_worker.cc | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/env.h b/src/env.h index e6ac144794e39b..5adc62f1cf0a6d 100644 --- a/src/env.h +++ b/src/env.h @@ -629,7 +629,7 @@ class Environment : public MemoryRetainer { // the ownership if transferred into the Environment. void InitializeInspector( std::unique_ptr parent_handle); - void WaitForInspectorFrontend(); + void WaitForInspectorFrontendByOptions(); #endif inline size_t async_callback_scope_depth() const; diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index ab40d2a46374d5..4cab7dea04379c 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -1051,8 +1051,9 @@ bool Agent::WaitForConnectByOptions() { parent_env_->options()->get_debug_options()->EnableBreakFirstLine(); } client_->waitForFrontend(); + return true; } - return true; + return false; } void Agent::StopIfWaitingForConnect() { diff --git a/src/node.cc b/src/node.cc index b91cadab99a6ea..64fffe525f321a 100644 --- a/src/node.cc +++ b/src/node.cc @@ -206,13 +206,13 @@ void Environment::InitializeInspector( } if (should_wait_for_inspector_frontend()) { - WaitForInspectorFrontend(); + WaitForInspectorFrontendByOptions(); } profiler::StartProfilers(this); } -void Environment::WaitForInspectorFrontend() { +void Environment::WaitForInspectorFrontendByOptions() { if (!inspector_agent_->WaitForConnectByOptions()) { return; } diff --git a/src/node_worker.cc b/src/node_worker.cc index 9cf7c1014ef58e..506870da080106 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -385,7 +385,7 @@ void Worker::Run() { Debug(this, "Created Environment for worker with id %llu", thread_id_.id); #if HAVE_INSPECTOR - this->env_->WaitForInspectorFrontend(); + this->env_->WaitForInspectorFrontendByOptions(); #endif if (is_stopped()) return; {