changeset 16726:7002bb17cc5e stable

posix: workaround lack of TIOCGWINSZ on Irix (issue3449) On an Irix 6.5.24 system, TIOCGWINSZ is not available. This means that any usage of the "hg" tool that looks up the terminal size (e.g. "hg help") will fail with an AttributeError. A simple work-around is just to wrap this block in mercurial/posix.py with a try/except so that it ends up using the default 80 characters width.
author Mark Round <hg@markround.com>
date Mon, 14 May 2012 13:25:42 +0100
parents 7bf48bc7de23
children 3e24ce3de5f1 3c398032bf46
files mercurial/posix.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/posix.py	Mon May 14 12:56:43 2012 +0200
+++ b/mercurial/posix.py	Mon May 14 13:25:42 2012 +0100
@@ -409,10 +409,13 @@
                     continue
                 if not os.isatty(fd):
                     continue
-                arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8)
-                width = array.array('h', arri)[1]
-                if width > 0:
-                    return width
+                try:
+                    arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8)
+                    width = array.array('h', arri)[1]
+                    if width > 0:
+                        return width
+                except AttributeError:
+                    pass
             except ValueError:
                 pass
             except IOError, e: