Skip to content

Commit

Permalink
Auto-merge for PR #812 via VersionBot
Browse files Browse the repository at this point in the history
Fix getting window size when there’s no TTY attached
  • Loading branch information
resin-io-versionbot[bot] committed Mar 15, 2018
2 parents 229c105 + b912419 commit 5625326
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).

## v7.0.3 - 2018-03-15

* Fix getting window size when there’s no TTY attached #812 [Akis Kesoglou]

## v7.0.2 - 2018-03-13

* Update full CLI docs with recent installation improvements too #807 [Tim Perry]
Expand Down
9 changes: 5 additions & 4 deletions lib/utils/tty.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
windowSize = {}

updateWindowSize = ->
size = require('window-size').get()
windowSize.width = size.width
windowSize.height = size.height
size = require('window-size')?.get()
windowSize.width = size?.width
windowSize.height = size?.height

process.stdout.on('resize', updateWindowSize)

Expand All @@ -13,7 +13,8 @@ module.exports = (stream = process.stdout) ->
updateWindowSize()

currentWindowSize = ->
# always return a copy
# always return a copy.
# width/height can be undefined if no TTY.
width: windowSize.width
height: windowSize.height

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "resin-cli",
"version": "7.0.2",
"version": "7.0.3",
"description": "The official resin.io CLI tool",
"main": "./build/actions/index.js",
"homepage": "https://github.com/resin-io/resin-cli",
Expand Down

0 comments on commit 5625326

Please sign in to comment.