diff --git a/lib/tty.js b/lib/tty.js index 576144e401..f9b8a34e95 100644 --- a/lib/tty.js +++ b/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'));