tty: require readline at top of file · nodejs/node@88b9572

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];