Skip to content

Commit 88b9572

Browse files
benglMylesBorins
authored andcommitted
tty: require readline at top of file
No need to require it on each of those function calls. Backport-PR-URL: #16264 PR-URL: #15647 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
1 parent cdba989 commit 88b9572

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/tty.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const TTY = process.binding('tty_wrap').TTY;
66
const isTTY = process.binding('tty_wrap').isTTY;
77
const inherits = util.inherits;
88
const errnoException = util._errnoException;
9+
const readline = require('readline');
910

1011

1112
exports.isatty = function(fd) {
@@ -90,16 +91,16 @@ WriteStream.prototype._refreshSize = function() {
9091

9192
// backwards-compat
9293
WriteStream.prototype.cursorTo = function(x, y) {
93-
require('readline').cursorTo(this, x, y);
94+
readline.cursorTo(this, x, y);
9495
};
9596
WriteStream.prototype.moveCursor = function(dx, dy) {
96-
require('readline').moveCursor(this, dx, dy);
97+
readline.moveCursor(this, dx, dy);
9798
};
9899
WriteStream.prototype.clearLine = function(dir) {
99-
require('readline').clearLine(this, dir);
100+
readline.clearLine(this, dir);
100101
};
101102
WriteStream.prototype.clearScreenDown = function() {
102-
require('readline').clearScreenDown(this);
103+
readline.clearScreenDown(this);
103104
};
104105
WriteStream.prototype.getWindowSize = function() {
105106
return [this.columns, this.rows];

0 commit comments

Comments
 (0)