~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-10-22 09:48:25 UTC
  • mfrom: (4763.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20091022094825-p8f7l834runsr2op
(joke, vila) terminal_width is now very large for non-tty

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 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
 
1306
 
1299
1307
    if sys.platform == 'win32':
1300
1308
        return win32utils.get_console_size()[0]
1301
1309
    width = 0