From 84e2f51d14a18dd0e1e492b32a1c5749ebd7a493 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Mon, 27 Nov 2023 14:35:48 +0100 Subject: [PATCH] src: register spawn_sync external references PR-URL: https://github.com/nodejs/node/pull/50943 Refs: https://github.com/nodejs/node/issues/50924 Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell --- src/node_external_reference.h | 1 + src/spawn_sync.cc | 7 +++++++ src/spawn_sync.h | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/node_external_reference.h b/src/node_external_reference.h index e516bf6471d4af..09a24aeef1b07f 100644 --- a/src/node_external_reference.h +++ b/src/node_external_reference.h @@ -123,6 +123,7 @@ class ExternalReferenceRegistry { V(string_decoder) \ V(stream_wrap) \ V(signal_wrap) \ + V(spawn_sync) \ V(trace_events) \ V(timers) \ V(types) \ diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc index b3c0fabafdaad2..3b73dc4a614b9a 100644 --- a/src/spawn_sync.cc +++ b/src/spawn_sync.cc @@ -22,6 +22,7 @@ #include "spawn_sync.h" #include "debug_utils-inl.h" #include "env-inl.h" +#include "node_external_reference.h" #include "node_internals.h" #include "string_bytes.h" #include "util-inl.h" @@ -366,6 +367,10 @@ void SyncProcessRunner::Initialize(Local target, SetMethod(context, target, "spawn", Spawn); } +void SyncProcessRunner::RegisterExternalReferences( + ExternalReferenceRegistry* registry) { + registry->Register(Spawn); +} void SyncProcessRunner::Spawn(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); @@ -1107,3 +1112,5 @@ void SyncProcessRunner::KillTimerCloseCallback(uv_handle_t* handle) { NODE_BINDING_CONTEXT_AWARE_INTERNAL(spawn_sync, node::SyncProcessRunner::Initialize) +NODE_BINDING_EXTERNAL_REFERENCE( + spawn_sync, node::SyncProcessRunner::RegisterExternalReferences) diff --git a/src/spawn_sync.h b/src/spawn_sync.h index 81a2f2aaa899ba..d5b74e67d83094 100644 --- a/src/spawn_sync.h +++ b/src/spawn_sync.h @@ -30,8 +30,7 @@ namespace node { - - +class ExternalReferenceRegistry; class SyncProcessOutputBuffer; class SyncProcessStdioPipe; class SyncProcessRunner; @@ -140,6 +139,7 @@ class SyncProcessRunner { }; public: + static void RegisterExternalReferences(ExternalReferenceRegistry* registry); static void Initialize(v8::Local target, v8::Local unused, v8::Local context,