Skip to content

Commit f68f572

Browse files
benglMylesBorins
authored andcommitted
tty: require readline at top of file
No need to require it on each of those function calls. PR-URL: #15647 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
1 parent d181147 commit f68f572

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
@@ -28,6 +28,7 @@ const isTTY = process.binding('tty_wrap').isTTY;
2828
const inherits = util.inherits;
2929
const errnoException = util._errnoException;
3030
const errors = require('internal/errors');
31+
const readline = require('readline');
3132

3233
exports.isatty = function(fd) {
3334
return isTTY(fd);
@@ -117,16 +118,16 @@ WriteStream.prototype._refreshSize = function() {
117118

118119
// backwards-compat
119120
WriteStream.prototype.cursorTo = function(x, y) {
120-
require('readline').cursorTo(this, x, y);
121+
readline.cursorTo(this, x, y);
121122
};
122123
WriteStream.prototype.moveCursor = function(dx, dy) {
123-
require('readline').moveCursor(this, dx, dy);
124+
readline.moveCursor(this, dx, dy);
124125
};
125126
WriteStream.prototype.clearLine = function(dir) {
126-
require('readline').clearLine(this, dir);
127+
readline.clearLine(this, dir);
127128
};
128129
WriteStream.prototype.clearScreenDown = function() {
129-
require('readline').clearScreenDown(this);
130+
readline.clearScreenDown(this);
130131
};
131132
WriteStream.prototype.getWindowSize = function() {
132133
return [this.columns, this.rows];

0 commit comments

Comments
 (0)