Browse Source

tty: avoid oob warning in TTYWrap::GetWindowSize()

PR-URL: https://github.com/nodejs/node/pull/11454
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
v6.x
Dmitry Tsvettsikh 8 years ago
committed by Myles Borins
parent
commit
1ed47d3f33
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 4
      lib/tty.js

4
lib/tty.js

@ -55,7 +55,7 @@ function WriteStream(fd) {
// Ref: https://github.com/nodejs/node/pull/1771#issuecomment-119351671 // Ref: https://github.com/nodejs/node/pull/1771#issuecomment-119351671
this._handle.setBlocking(process.env.NODE_TTY_UNSAFE_ASYNC !== '1'); this._handle.setBlocking(process.env.NODE_TTY_UNSAFE_ASYNC !== '1');
var winSize = []; var winSize = new Array(2);
var err = this._handle.getWindowSize(winSize); var err = this._handle.getWindowSize(winSize);
if (!err) { if (!err) {
this.columns = winSize[0]; this.columns = winSize[0];
@ -72,7 +72,7 @@ WriteStream.prototype.isTTY = true;
WriteStream.prototype._refreshSize = function() { WriteStream.prototype._refreshSize = function() {
var oldCols = this.columns; var oldCols = this.columns;
var oldRows = this.rows; var oldRows = this.rows;
var winSize = []; var winSize = new Array(2);
var err = this._handle.getWindowSize(winSize); var err = this._handle.getWindowSize(winSize);
if (err) { if (err) {
this.emit('error', errnoException(err, 'getWindowSize')); this.emit('error', errnoException(err, 'getWindowSize'));

Loading…
Cancel
Save