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

get_terminal_size() returns (0, 0) in certain circumstances #607

Closed
stxlvt opened this issue Jul 13, 2016 · 3 comments
Closed

get_terminal_size() returns (0, 0) in certain circumstances #607

stxlvt opened this issue Jul 13, 2016 · 3 comments

Comments

@stxlvt
Copy link
Contributor

stxlvt commented Jul 13, 2016

Using windows 7, python 2.7 and click 6.4, this code prints (0, 0):

import subprocess

print(subprocess.check_output(["python", "-c", "import click; print(click.get_terminal_size())"]))

A dumb fix that gives more sensible output for me is to replace line 170 of termui.py with this:

        size = get_winterm_size()
        if size == (0, 0):
            return (79, 24)
        else:
            return size
@stxlvt
Copy link
Contributor Author

stxlvt commented Jul 14, 2016

I should add that this is gives real-world problems. In my specific case, using sphinxcontrib-programoutput to include output from a click-powered command line utility in the documentation will result in output wrapped at 50 characters, which does not look good.

@stxlvt
Copy link
Contributor Author

stxlvt commented Jul 14, 2016

I've created a pull request here.

@fdavis
Copy link
Contributor

fdavis commented May 15, 2018

thanks @stxlvt
closing because this is resolved by #610

@fdavis fdavis closed this as completed May 15, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants