Rev 4750: More complete fix (previous one changed the focus). in file:///home/vila/src/bzr/bugs/353370-notty-no-term-width/

Vincent Ladeuil v.ladeuil+lp at
Thu Oct 22 16:19:59 BST 2009

At file:///home/vila/src/bzr/bugs/353370-notty-no-term-width/

revno: 4750
revision-id: v.ladeuil+lp at
parent: v.ladeuil+lp at
committer: Vincent Ladeuil <v.ladeuil+lp at>
branch nick: 353370-notty-no-term-width
timestamp: Thu 2009-10-22 17:19:59 +0200
  More complete fix (previous one changed the focus).
  * bzrlib/
  (terminal_width): Respect original intent *in addition* to
  catching streams without isatty() method.
-------------- next part --------------
=== modified file 'bzrlib/'
--- a/bzrlib/	2009-10-22 08:40:35 +0000
+++ b/bzrlib/	2009-10-22 15:19:59 +0000
@@ -1296,7 +1296,8 @@
 def terminal_width():
     """Return estimated terminal width."""
-    if getattr(sys.stdout, 'isatty', None) is None:
+    isatty = getattr(sys.stdout, 'isatty', None)
+    if  isatty is None or not isatty():
         # If it's not a tty, the width makes no sense. We just use a value bug
         # enough to avoid truncations. When the output is redirected, the
         # pagers can then handle that themselves. A cleaner implementation

More information about the bazaar-commits mailing list