Skip to content
Permalink
Browse files

os: move process.binding('os') to internalBinding

PR-URL: #25087
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
briete authored and BridgeAR committed Dec 17, 2018
1 parent 65c136f commit 55d185f0ddbbaf9d073ae9d89770de1d2207bfa2
@@ -87,6 +87,7 @@
'icu',
'js_stream',
'natives',
'os',
'pipe_wrap',
'process_wrap',
'signal_wrap',
@@ -44,7 +44,7 @@ const {
getUptime,
isBigEndian,
setPriority: _setPriority
} = process.binding('os');
} = internalBinding('os');

function getCheckedFunction(fn) {
return function checkError(...args) {
@@ -467,4 +467,4 @@ void Initialize(Local<Object> target,
} // namespace os
} // namespace node

NODE_BUILTIN_MODULE_CONTEXT_AWARE(os, node::os::Initialize)
NODE_MODULE_CONTEXT_AWARE_INTERNAL(os, node::os::Initialize)
@@ -1,7 +1,11 @@
'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.
process.binding('os').getHomeDirectory = function(ctx) {
internalBinding('os').getHomeDirectory = function(ctx) {
ctx.syscall = 'foo';
ctx.code = 'bar';
ctx.message = 'baz';
@@ -16,3 +16,4 @@ assert(process.binding('url'));
assert(process.binding('spawn_sync'));
assert(process.binding('js_stream'));
assert(process.binding('buffer'));
assert(process.binding('os'));

0 comments on commit 55d185f

Please sign in to comment.
You can’t perform that action at this time.