mercurial/posix.py
changeset 14165 78bdfc756908
parent 14004 97ed99d1f419
child 14231 8abe4db2d162
--- a/mercurial/posix.py	Mon May 02 19:21:30 2011 +0200
+++ b/mercurial/posix.py	Mon Apr 18 02:42:52 2011 +0200
@@ -316,7 +316,9 @@
                 if not os.isatty(fd):
                     continue
                 arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8)
-                return array.array('h', arri)[1]
+                width = array.array('h', arri)[1]
+                if width > 0:
+                    return width
             except ValueError:
                 pass
             except IOError, e: