diff -r 7bf48bc7de23 -r 7002bb17cc5e mercurial/posix.py --- 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: