Maybe your terminal doesn't send resize events? I tried it on macOS 10.12 in iTerm2 v3 and Node.js 6.2.2 and it worked as expected.
I put the following in the Node.js REPL:
process.stdout.on('resize', () => {console.log(process.stdout.columns, process.stdout.rows)})
And this is the output:
WriteStream {
connecting: false,
_hadError: false,
_handle:
TTY {
bytesRead: 0,
_externalStream: {},
fd: 10,
writeQueueSize: 0,
owner: [Circular],
onread: [Function: onread] },
_parent: null,
_host: null,
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [],
length: 0,
pipes: null,
pipesCount: 0,
flowing: null,
ended: false,
endEmitted: false,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain: null,
_events:
{ end: { [Function: g] listener: [Function: onend] },
finish: [Function: onSocketFinish],
_socketEnd: [Function: onSocketEnd],
resize: [ [Function: onresize], [Function] ] },
_eventsCount: 4,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
needDrain: false,
ending: false,
ended: false,
finished: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 1,
prefinished: false,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: CorkedRequest { next: null, entry: null, finish: [Function] } },
writable: true,
allowHalfOpen: false,
destroyed: false,
_bytesDispatched: 5873,
_sockname: null,
_writev: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
columns: 343,
rows: 25,
_type: 'tty',
fd: 1,
_isStdio: true,
destroySoon: [Function],
destroy: [Function] }
> 343 26
> 343 27
> 343 28
> 343 29
> 343 30
> 343 31
> 343 32
> 343 33
> 343 34
> 343 35
> 343 36
> 343 37
> 343 38
> 343 39
> 343 40
> 343 41
> 343 42
> 343 43
> 343 44
> 343 43
> 343 42
> 343 41
> 343 40
> 343 39
> 343 38
> 343 37
> 343 36
> 343 35
> 343 34
> 343 33
> 343 32
> 343 31
> 343 30
> 343 29
> 343 28
> 343 29
> 343 30
> 343 31
> 343 32
> 343 33
> 343 34
> 343 35
> 343 36
> 343 37
> 343 38
> 343 39
> 343 38
> 343 37
> 343 36
> 343 35
> 343 34
> 343 33
> 343 32
> 343 31
> 343 30
> 343 29
> 343 28
> 343 27
> 343 28
> 343 27
> 343 26
> 343 25
> 343 24
> 343 23
> 343 24
On resize it reported the visible size of my terminal showed on my 3400x1440 ultra wide screen display.
