changeset 8347:a3826fff1e87

util.termwidth: a file-like object may legitimately lack a fileno() method Spotted in the wild when running a hook while pushing over HTTPS.
author Bryan O'Sullivan <bos@serpentine.com>
date Mon, 11 May 2009 11:53:27 -0700
parents b579823cc546
children c9ab8f448a9e
files mercurial/util.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Mon May 11 14:19:49 2009 +0200
+++ b/mercurial/util.py	Mon May 11 11:53:27 2009 -0700
@@ -1438,7 +1438,10 @@
         import termios, array, fcntl
         for dev in (sys.stdout, sys.stdin):
             try:
-                fd = dev.fileno()
+                try:
+                    fd = dev.fileno()
+                except AttributeError:
+                    continue
                 if not os.isatty(fd):
                     continue
                 arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8)