Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getting window size when there’s no TTY attached #812

Merged
2 commits merged into from
Mar 15, 2018
Merged

Conversation

dfunckt
Copy link
Member

@dfunckt dfunckt commented Mar 15, 2018

Change-Type: patch

@dfunckt dfunckt requested a review from pimterry March 15, 2018 08:25
Copy link
Contributor

@pimterry pimterry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits, but nothing that needs to block this

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

currentWindowSize = ->
# always return a copy
# always return a copy.
# width/height can be null if no TTY.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined, not null

@@ -619,7 +619,7 @@ class BuildProgressUI

_clear: ->
@_tty.deleteToEnd()
@_maxLineWidth = @_tty.currentWindowSize().width
@_maxLineWidth = @_tty.currentWindowSize()?.width
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need this currentWindowSize is always defined still, it's just the width that might not be, and that's fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, that's was the whole point, to call currentWindowSize() and be sure there's always width/height props, even if null/undefined.

@ghost
Copy link

ghost commented Mar 15, 2018

VersionBot failed to carry out a status check for the above pull request here: #812. The reason for this is:
2 of 5 required status checks are pending.
Please carry out relevant changes or alert an appropriate admin.

@ghost
Copy link

ghost commented Mar 15, 2018

VersionBot failed to carry out a status check for the above pull request here: #812. The reason for this is:
2 of 5 required status checks are pending.
Please carry out relevant changes or alert an appropriate admin.

@ghost ghost merged commit 5625326 into master Mar 15, 2018
@ghost ghost deleted the fix-no-tty branch March 15, 2018 08:54
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants