Skip to content

Commit

Permalink
src: register spawn_sync external references
Browse files Browse the repository at this point in the history
PR-URL: #50943
Refs: #50924
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
joyeecheung authored and RafaelGSS committed Dec 15, 2023
1 parent 2cfee53 commit 84e2f51
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/node_external_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
7 changes: 7 additions & 0 deletions src/spawn_sync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -366,6 +367,10 @@ void SyncProcessRunner::Initialize(Local<Object> target,
SetMethod(context, target, "spawn", Spawn);
}

void SyncProcessRunner::RegisterExternalReferences(
ExternalReferenceRegistry* registry) {
registry->Register(Spawn);
}

void SyncProcessRunner::Spawn(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
Expand Down Expand Up @@ -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)
4 changes: 2 additions & 2 deletions src/spawn_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@

namespace node {



class ExternalReferenceRegistry;
class SyncProcessOutputBuffer;
class SyncProcessStdioPipe;
class SyncProcessRunner;
Expand Down Expand Up @@ -140,6 +139,7 @@ class SyncProcessRunner {
};

public:
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context,
Expand Down

0 comments on commit 84e2f51

Please sign in to comment.