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
Dmitry Tsvettsikh 8 years ago
committed by Anna Henningsen
parent
commit
3f02b47b8a
No known key found for this signature in database GPG Key ID: D8B9F5AEAE84E4CF
  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
this._handle.setBlocking(process.env.NODE_TTY_UNSAFE_ASYNC !== '1');
var winSize = [];
var winSize = new Array(2);
var err = this._handle.getWindowSize(winSize);
if (!err) {
this.columns = winSize[0];
@ -72,7 +72,7 @@ WriteStream.prototype.isTTY = true;
WriteStream.prototype._refreshSize = function() {
var oldCols = this.columns;
var oldRows = this.rows;
var winSize = [];
var winSize = new Array(2);
var err = this._handle.getWindowSize(winSize);
if (err) {
this.emit('error', errnoException(err, 'getWindowSize'));

Loading…
Cancel
Save