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 free.fr
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 free.fr-20091022151959-4nk4w3g0cvt2555n
parent: v.ladeuil+lp at free.fr-20091022084035-swi9xvao11z2w7ke
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 353370-notty-no-term-width
timestamp: Thu 2009-10-22 17:19:59 +0200
message:
  More complete fix (previous one changed the focus).
  
  * bzrlib/osutils.py:
  (terminal_width): Respect original intent *in addition* to
  catching streams without isatty() method.
-------------- next part --------------
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2009-10-22 08:40:35 +0000
+++ b/bzrlib/osutils.py	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