GeezerVison is showing github.com — tty: initialize winSize array with values · nodejs/node@a033dff
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/tty.js +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
22 | 22 | 'use strict'; |
23 | 23 |
|
24 | 24 | const { |
25 | | - Array, |
26 | 25 | NumberIsInteger, |
27 | 26 | ObjectSetPrototypeOf, |
28 | 27 | } = primordials; |
@@ -106,7 +105,7 @@ function WriteStream(fd) { |
106 | 105 | // Ref: https://github.com/nodejs/node/pull/1771#issuecomment-119351671 |
107 | 106 | this._handle.setBlocking(true); |
108 | 107 |
|
109 | | - const winSize = new Array(2); |
| 108 | + const winSize = [0, 0]; |
110 | 109 | const err = this._handle.getWindowSize(winSize); |
111 | 110 | if (!err) { |
112 | 111 | this.columns = winSize[0]; |
@@ -126,7 +125,7 @@ WriteStream.prototype.hasColors = hasColors; |
126 | 125 | WriteStream.prototype._refreshSize = function() { |
127 | 126 | const oldCols = this.columns; |
128 | 127 | const oldRows = this.rows; |
129 | | - const winSize = new Array(2); |
| 128 | + const winSize = [0, 0]; |
130 | 129 | const err = this._handle.getWindowSize(winSize); |
131 | 130 | if (err) { |
132 | 131 | this.emit('error', new errors.ErrnoException(err, 'getWindowSize')); |
|