From f773fbbdd6d2cde6b643e164ca2eb749b6f1b56b Mon Sep 17 00:00:00 2001 From: nd-02110114 Date: Wed, 20 Mar 2019 13:37:55 +0900 Subject: [PATCH 1/2] lib: remove util.inherits in tty.js --- lib/tty.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/tty.js b/lib/tty.js index bc568146fd2acb..e94c06d48a3c7e 100644 --- a/lib/tty.js +++ b/lib/tty.js @@ -21,7 +21,6 @@ 'use strict'; -const { inherits } = require('util'); const net = require('net'); const { TTY, isTTY } = internalBinding('tty_wrap'); const errors = require('internal/errors'); @@ -61,7 +60,7 @@ function ReadStream(fd, options) { this.isRaw = false; this.isTTY = true; } -inherits(ReadStream, net.Socket); +Object.setPrototypeOf(ReadStream.prototype, net.Socket.prototype); ReadStream.prototype.setRawMode = function(flag) { flag = !!flag; @@ -106,7 +105,7 @@ function WriteStream(fd) { this.rows = winSize[1]; } } -inherits(WriteStream, net.Socket); +Object.setPrototypeOf(WriteStream.prototype, net.Socket.prototype); WriteStream.prototype.isTTY = true; From d18d5ecef45cedf8b01bd10357d69d408ab944c7 Mon Sep 17 00:00:00 2001 From: nd-02110114 Date: Wed, 20 Mar 2019 18:27:10 +0900 Subject: [PATCH 2/2] fix build error --- lib/tty.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tty.js b/lib/tty.js index e94c06d48a3c7e..aef2d6c54ee53a 100644 --- a/lib/tty.js +++ b/lib/tty.js @@ -60,7 +60,9 @@ function ReadStream(fd, options) { this.isRaw = false; this.isTTY = true; } + Object.setPrototypeOf(ReadStream.prototype, net.Socket.prototype); +Object.setPrototypeOf(ReadStream, net.Socket); ReadStream.prototype.setRawMode = function(flag) { flag = !!flag; @@ -105,7 +107,9 @@ function WriteStream(fd) { this.rows = winSize[1]; } } + Object.setPrototypeOf(WriteStream.prototype, net.Socket.prototype); +Object.setPrototypeOf(WriteStream, net.Socket); WriteStream.prototype.isTTY = true;