GeezerVison is showing github.com — os: move process.binding('os') to internalBinding · nodejs/node@d197105
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/bootstrap/loaders.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -93,6 +93,7 @@ const internalBindingWhitelist = [ |
93 | 93 | 'inspector', |
94 | 94 | 'js_stream', |
95 | 95 | 'natives', |
| 96 | + 'os', |
96 | 97 | 'pipe_wrap', |
97 | 98 | 'process_wrap', |
98 | 99 | 'signal_wrap', |
|
Collapse file
Copy file name to clipboardExpand all lines: lib/os.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -44,7 +44,7 @@ const { |
44 | 44 | getUptime, |
45 | 45 | isBigEndian, |
46 | 46 | setPriority: _setPriority |
47 | | -} = process.binding('os'); |
| 47 | +} = internalBinding('os'); |
48 | 48 |
|
49 | 49 | function getCheckedFunction(fn) { |
50 | 50 | return function checkError(...args) { |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node_os.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -467,4 +467,4 @@ void Initialize(Local<Object> target, |
467 | 467 | } // namespace os |
468 | 468 | } // namespace node |
469 | 469 |
|
470 | | -NODE_BUILTIN_MODULE_CONTEXT_AWARE(os, node::os::Initialize) |
| 470 | +NODE_MODULE_CONTEXT_AWARE_INTERNAL(os, node::os::Initialize) |
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-os-checked-function.js +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | 'use strict'; |
| 2 | +// Flags: --expose_internals |
| 3 | + |
| 4 | +const { internalBinding } = require('internal/test/binding'); |
| 5 | + |
2 | 6 | // Monkey patch the os binding before requiring any other modules, including |
3 | 7 | // common, which requires the os module. |
4 | | -process.binding('os').getHomeDirectory = function(ctx) { |
| 8 | +internalBinding('os').getHomeDirectory = function(ctx) { |
5 | 9 | ctx.syscall = 'foo'; |
6 | 10 | ctx.code = 'bar'; |
7 | 11 | ctx.message = 'baz'; |
|
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-process-binding-internalbinding-whitelist.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -18,3 +18,4 @@ assert(process.binding('js_stream')); |
18 | 18 | assert(process.binding('buffer')); |
19 | 19 | assert(process.binding('fs')); |
20 | 20 | assert(process.binding('inspector')); |
| 21 | +assert(process.binding('os')); |