src: fix Worker termination when `--inspect-brk` is passed
Fixes: #53648 (closed)
When calling node::CreateEnvironment
with debug options like --inspect-brk
, Environment creation is blocked until an Inspector frontend connects. While creating a Worker thread's Environment, its InspectorAgent, which is owned by the Environment instance and controls exit, is not usable until creation is complete.
This patch allows separate handling of Environment creation and Inspector frontend connection waiting, resolving the issue by creating the Environment instance first in worker threads.
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com