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>

Backport-PR-URL: #25446
  • Loading branch information...
briete authored and addaleax committed Dec 17, 2018
1 parent 445ba9f commit d197105476b7669207f761c64fbbd0dbed7cf916
@@ -93,6 +93,7 @@ const internalBindingWhitelist = [
'inspector',
'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';
@@ -18,3 +18,4 @@ assert(process.binding('js_stream'));
assert(process.binding('buffer'));
assert(process.binding('fs'));
assert(process.binding('inspector'));
assert(process.binding('os'));

0 comments on commit d197105

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