From f64e5ec1482873d286a5f474f995763e041ee614 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Fri, 11 Jan 2019 22:27:19 +0800 Subject: [PATCH] Revert "os: move process.binding('os') to internalBinding" This reverts commit 55d185f0ddbbaf9d073ae9d89770de1d2207bfa2. PR-URL: https://github.com/nodejs/node/pull/25446 Reviewed-By: Anna Henningsen --- lib/internal/bootstrap/loaders.js | 1 - lib/os.js | 2 +- src/node_os.cc | 2 +- test/parallel/test-os-checked-function.js | 6 +----- .../test-process-binding-internalbinding-whitelist.js | 1 - 5 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index 5c0a5b6aa1fb80..2d197c768c7107 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -87,7 +87,6 @@ 'icu', 'js_stream', 'natives', - 'os', 'pipe_wrap', 'process_wrap', 'signal_wrap', diff --git a/lib/os.js b/lib/os.js index 1acc69a2415b3d..2c806908eeac98 100644 --- a/lib/os.js +++ b/lib/os.js @@ -44,7 +44,7 @@ const { getUptime, isBigEndian, setPriority: _setPriority -} = internalBinding('os'); +} = process.binding('os'); function getCheckedFunction(fn) { return function checkError(...args) { diff --git a/src/node_os.cc b/src/node_os.cc index 6ecfb7fe9f8f44..72719f2933728c 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -467,4 +467,4 @@ void Initialize(Local target, } // namespace os } // namespace node -NODE_MODULE_CONTEXT_AWARE_INTERNAL(os, node::os::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(os, node::os::Initialize) diff --git a/test/parallel/test-os-checked-function.js b/test/parallel/test-os-checked-function.js index 2a393f830d4b76..04c2c3a1f82ea3 100644 --- a/test/parallel/test-os-checked-function.js +++ b/test/parallel/test-os-checked-function.js @@ -1,11 +1,7 @@ 'use strict'; -// Flags: --expose_internals - -const { internalBinding } = require('internal/test/binding'); - // Monkey patch the os binding before requiring any other modules, including // common, which requires the os module. -internalBinding('os').getHomeDirectory = function(ctx) { +process.binding('os').getHomeDirectory = function(ctx) { ctx.syscall = 'foo'; ctx.code = 'bar'; ctx.message = 'baz'; diff --git a/test/parallel/test-process-binding-internalbinding-whitelist.js b/test/parallel/test-process-binding-internalbinding-whitelist.js index c7b683a88a1376..9cd12b54ea0f8a 100644 --- a/test/parallel/test-process-binding-internalbinding-whitelist.js +++ b/test/parallel/test-process-binding-internalbinding-whitelist.js @@ -16,4 +16,3 @@ assert(process.binding('url')); assert(process.binding('spawn_sync')); assert(process.binding('js_stream')); assert(process.binding('buffer')); -assert(process.binding('os'));