Skip to content

Commit

Permalink
os: move process.binding('os') to internalBinding
Browse files Browse the repository at this point in the history
PR-URL: #25087
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
briete authored and BridgeAR committed Jan 10, 2019
1 parent 65c136f commit 55d185f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/internal/bootstrap/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
'icu',
'js_stream',
'natives',
'os',
'pipe_wrap',
'process_wrap',
'signal_wrap',
Expand Down
2 changes: 1 addition & 1 deletion lib/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const {
getUptime,
isBigEndian,
setPriority: _setPriority
} = process.binding('os');
} = internalBinding('os');

function getCheckedFunction(fn) {
return function checkError(...args) {
Expand Down
2 changes: 1 addition & 1 deletion src/node_os.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 5 additions & 1 deletion test/parallel/test-os-checked-function.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.