tty: make process.binding('tty_wrap') internal
PR-URL: https://github.com/nodejs/node/pull/22477 Refs: https://github.com/nodejs/node/issues/22160 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
parent
1abbe0a212
commit
df073cdda4
@ -353,6 +353,7 @@
|
||||
'http_parser',
|
||||
'process_wrap',
|
||||
'v8',
|
||||
'tty_wrap',
|
||||
'stream_wrap',
|
||||
'signal_wrap',
|
||||
'crypto',
|
||||
|
@ -26,8 +26,8 @@ const { internalBinding } = require('internal/bootstrap/loaders');
|
||||
const { Process } = internalBinding('process_wrap');
|
||||
const { WriteWrap } = internalBinding('stream_wrap');
|
||||
const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap');
|
||||
const { TTY } = process.binding('tty_wrap');
|
||||
const { TCP } = internalBinding('tcp_wrap');
|
||||
const { TTY } = internalBinding('tty_wrap');
|
||||
const { UDP } = process.binding('udp_wrap');
|
||||
const SocketList = require('internal/socket_list');
|
||||
const { owner_symbol } = require('internal/async_hooks').symbols;
|
||||
|
@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
const { codes } = require('internal/errors');
|
||||
const { internalBinding } = require('internal/bootstrap/loaders');
|
||||
const { UDP } = process.binding('udp_wrap');
|
||||
const { isInt32 } = require('internal/validators');
|
||||
const TTYWrap = process.binding('tty_wrap');
|
||||
const { internalBinding } = require('internal/bootstrap/loaders');
|
||||
const TTYWrap = internalBinding('tty_wrap');
|
||||
const { UV_EINVAL } = internalBinding('uv');
|
||||
const { ERR_INVALID_ARG_TYPE, ERR_SOCKET_BAD_TYPE } = codes;
|
||||
const kStateSymbol = Symbol('state symbol');
|
||||
|
@ -47,7 +47,8 @@ function getMainThreadStdio() {
|
||||
|
||||
function getStdin() {
|
||||
if (stdin) return stdin;
|
||||
const tty_wrap = process.binding('tty_wrap');
|
||||
const { internalBinding } = require('internal/bootstrap/loaders');
|
||||
const tty_wrap = internalBinding('tty_wrap');
|
||||
const fd = 0;
|
||||
|
||||
switch (tty_wrap.guessHandleType(fd)) {
|
||||
@ -163,7 +164,8 @@ function setupProcessStdio({ getStdout, getStdin, getStderr }) {
|
||||
|
||||
function createWritableStdioStream(fd) {
|
||||
var stream;
|
||||
const tty_wrap = process.binding('tty_wrap');
|
||||
const { internalBinding } = require('internal/bootstrap/loaders');
|
||||
const tty_wrap = internalBinding('tty_wrap');
|
||||
|
||||
// Note stream._type is used for test-module-load-list.js
|
||||
|
||||
|
@ -42,7 +42,7 @@ const {
|
||||
} = internalBinding('uv');
|
||||
|
||||
const { Buffer } = require('buffer');
|
||||
const TTYWrap = process.binding('tty_wrap');
|
||||
const TTYWrap = internalBinding('tty_wrap');
|
||||
const { ShutdownWrap } = internalBinding('stream_wrap');
|
||||
const {
|
||||
TCP,
|
||||
|
@ -23,7 +23,8 @@
|
||||
|
||||
const { inherits, _extend } = require('util');
|
||||
const net = require('net');
|
||||
const { TTY, isTTY } = process.binding('tty_wrap');
|
||||
const { internalBinding } = require('internal/bootstrap/loaders');
|
||||
const { TTY, isTTY } = internalBinding('tty_wrap');
|
||||
const errors = require('internal/errors');
|
||||
const {
|
||||
ERR_INVALID_FD,
|
||||
|
@ -173,4 +173,4 @@ TTYWrap::TTYWrap(Environment* env,
|
||||
|
||||
} // namespace node
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(tty_wrap, node::TTYWrap::Initialize)
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(tty_wrap, node::TTYWrap::Initialize)
|
||||
|
@ -1,3 +1,4 @@
|
||||
// Flags: --expose-internals
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
@ -9,7 +10,8 @@ const assert = require('assert');
|
||||
|
||||
// Objects that call StreamBase::AddMethods, when setting up
|
||||
// their prototype
|
||||
const TTY = process.binding('tty_wrap').TTY;
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const TTY = internalBinding('tty_wrap').TTY;
|
||||
const UDP = process.binding('udp_wrap').UDP;
|
||||
|
||||
{
|
||||
|
@ -1,3 +1,4 @@
|
||||
// Flags: --expose-internals
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
@ -9,7 +10,8 @@ require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
// Or anything that calls StreamBase::AddMethods when setting up its prototype
|
||||
const TTY = process.binding('tty_wrap').TTY;
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const TTY = internalBinding('tty_wrap').TTY;
|
||||
|
||||
{
|
||||
assert.strictEqual(TTY.prototype.propertyIsEnumerable('bytesRead'), false);
|
||||
|
@ -1,8 +1,10 @@
|
||||
// Flags: --expose-internals
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
|
||||
const noop = () => {};
|
||||
const TTY = process.binding('tty_wrap').TTY = function() {};
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const TTY = internalBinding('tty_wrap').TTY = function() {};
|
||||
|
||||
TTY.prototype = {
|
||||
setBlocking: noop,
|
||||
|
@ -1,8 +1,10 @@
|
||||
// Flags: --expose-internals --no-warnings
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
|
||||
const { TTY, isTTY } = process.binding('tty_wrap');
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const { TTY, isTTY } = internalBinding('tty_wrap');
|
||||
const strictEqual = require('assert').strictEqual;
|
||||
|
||||
strictEqual(isTTY(0), true, 'fd 0 is not a TTY');
|
||||
|
@ -5,9 +5,9 @@
|
||||
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const tty_wrap = process.binding('tty_wrap');
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const { TTYWRAP } = internalBinding('async_wrap').Providers;
|
||||
const tty_wrap = internalBinding('tty_wrap');
|
||||
const providers = { TTYWRAP };
|
||||
|
||||
// Make sure that the TTYWRAP Provider is tested.
|
||||
|
@ -1,3 +1,4 @@
|
||||
// Flags: --expose-internals --no-warnings
|
||||
'use strict';
|
||||
|
||||
// see also test/parallel/test-handle-wrap-isrefed.js
|
||||
@ -6,7 +7,8 @@ const common = require('../common');
|
||||
const strictEqual = require('assert').strictEqual;
|
||||
const ReadStream = require('tty').ReadStream;
|
||||
const tty = new ReadStream(0);
|
||||
const isTTY = process.binding('tty_wrap').isTTY;
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const isTTY = internalBinding('tty_wrap').isTTY;
|
||||
strictEqual(isTTY(0), true, 'tty_wrap: stdin is not a TTY');
|
||||
strictEqual(Object.getPrototypeOf(tty._handle).hasOwnProperty('hasRef'),
|
||||
true, 'tty_wrap: hasRef() missing');
|
||||
|
@ -1,8 +1,10 @@
|
||||
// Flags: --expose-internals --no-warnings
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const { WriteStream } = require('tty');
|
||||
const { TTY } = process.binding('tty_wrap');
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const { TTY } = internalBinding('tty_wrap');
|
||||
const getWindowSize = TTY.prototype.getWindowSize;
|
||||
|
||||
function monkeyPatchGetWindowSize(fn) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
require('../common');
|
||||
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const { TTY } = process.binding('tty_wrap');
|
||||
const { TTY } = internalBinding('tty_wrap');
|
||||
const { WriteWrap } = internalBinding('stream_wrap');
|
||||
|
||||
const handle = new TTY(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user