From 9c9c01f1839e931b27993439ae7076aba8f25c01 Mon Sep 17 00:00:00 2001 From: Anto Aravinth Date: Tue, 4 Sep 2018 19:40:51 +0530 Subject: [PATCH] child_process: move process.binding('spawn_sync') to internalBinding PR-URL: https://github.com/nodejs/node/pull/22260 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat Reviewed-By: John-David Dalton Reviewed-By: Denys Otrishko Reviewed-By: Ruben Bridgewater --- lib/internal/bootstrap/node.js | 3 ++- lib/internal/child_process.js | 3 +-- src/spawn_sync.cc | 2 +- .../parallel/test-process-binding-internalbinding-whitelist.js | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 265bc81d0c8711..418c93f0d5ac4e 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -376,7 +376,8 @@ 'tls_wrap', 'util', 'async_wrap', - 'url']); + 'url', + 'spawn_sync']); process.binding = function binding(name) { return internalBindingWhitelist.has(name) ? internalBinding(name) : diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index a4850f0238d119..1c5aace9151e88 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -22,7 +22,6 @@ const util = require('util'); const assert = require('assert'); const { internalBinding } = require('internal/bootstrap/loaders'); - const { Process } = internalBinding('process_wrap'); const { WriteWrap } = internalBinding('stream_wrap'); const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap'); @@ -33,7 +32,7 @@ const SocketList = require('internal/socket_list'); const { owner_symbol } = require('internal/async_hooks').symbols; const { convertToValidSignal } = require('internal/util'); const { isArrayBufferView } = require('internal/util/types'); -const spawn_sync = process.binding('spawn_sync'); +const spawn_sync = internalBinding('spawn_sync'); const { HTTPParser } = internalBinding('http_parser'); const { freeParser } = require('_http_common'); const { kStateSymbol } = require('internal/dgram'); diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc index 46d895e38a7389..fbcb1d4f02c905 100644 --- a/src/spawn_sync.cc +++ b/src/spawn_sync.cc @@ -1100,5 +1100,5 @@ void SyncProcessRunner::KillTimerCloseCallback(uv_handle_t* handle) { } // namespace node -NODE_BUILTIN_MODULE_CONTEXT_AWARE(spawn_sync, +NODE_MODULE_CONTEXT_AWARE_INTERNAL(spawn_sync, node::SyncProcessRunner::Initialize) diff --git a/test/parallel/test-process-binding-internalbinding-whitelist.js b/test/parallel/test-process-binding-internalbinding-whitelist.js index 49b4fbd82caee5..7076650e1bce78 100644 --- a/test/parallel/test-process-binding-internalbinding-whitelist.js +++ b/test/parallel/test-process-binding-internalbinding-whitelist.js @@ -13,3 +13,4 @@ assert(process.binding('stream_wrap')); assert(process.binding('signal_wrap')); assert(process.binding('contextify')); assert(process.binding('url')); +assert(process.binding('spawn_sync'));