Skip to content

Commit 83f6ec8

Browse files
nissy-devtargos
authored andcommitted
tty: remove util.inherits usage
PR-URL: #26797 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
1 parent bf2b57e commit 83f6ec8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/tty.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
'use strict';
2323

24-
const { inherits } = require('util');
2524
const net = require('net');
2625
const { TTY, isTTY } = internalBinding('tty_wrap');
2726
const errors = require('internal/errors');
@@ -61,7 +60,9 @@ function ReadStream(fd, options) {
6160
this.isRaw = false;
6261
this.isTTY = true;
6362
}
64-
inherits(ReadStream, net.Socket);
63+
64+
Object.setPrototypeOf(ReadStream.prototype, net.Socket.prototype);
65+
Object.setPrototypeOf(ReadStream, net.Socket);
6566

6667
ReadStream.prototype.setRawMode = function(flag) {
6768
flag = !!flag;
@@ -106,7 +107,9 @@ function WriteStream(fd) {
106107
this.rows = winSize[1];
107108
}
108109
}
109-
inherits(WriteStream, net.Socket);
110+
111+
Object.setPrototypeOf(WriteStream.prototype, net.Socket.prototype);
112+
Object.setPrototypeOf(WriteStream, net.Socket);
110113

111114
WriteStream.prototype.isTTY = true;
112115

0 commit comments

Comments
 (0)