/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

Tweaked as hinted in reviews.

* bzrlib/osutils.py:
(terminal_width): Still returns an insanely high value, but
explaining why and making sure we work in more cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1296
1296
 
1297
1297
def terminal_width():
1298
1298
    """Return estimated terminal width."""
1299
 
    if not sys.stdout.isatty():
1300
 
        return 10000
 
1299
    if getattr(sys.stdout, 'isatty', None) is None:
 
1300
        # If it's not a tty, the width makes no sense. We just use a value bug
 
1301
        # enough to avoid truncations. When the output is redirected, the
 
1302
        # pagers can then handle that themselves. A cleaner implementation
 
1303
        # would be to fix the callers to not try to format at all in these
 
1304
        # circumstances.
 
1305
        return 65536
1301
1306
 
1302
1307
    if sys.platform == 'win32':
1303
1308
        return win32utils.get_console_size()[0]