Mercurial > hg
comparison mercurial/posix.py @ 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 | f5dd179bfa4a |
children | 0cb55b5c19a3 |
comparison
equal
deleted
inserted
replaced
16722:7bf48bc7de23 | 16726:7002bb17cc5e |
---|---|
407 fd = dev.fileno() | 407 fd = dev.fileno() |
408 except AttributeError: | 408 except AttributeError: |
409 continue | 409 continue |
410 if not os.isatty(fd): | 410 if not os.isatty(fd): |
411 continue | 411 continue |
412 arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8) | 412 try: |
413 width = array.array('h', arri)[1] | 413 arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8) |
414 if width > 0: | 414 width = array.array('h', arri)[1] |
415 return width | 415 if width > 0: |
416 return width | |
417 except AttributeError: | |
418 pass | |
416 except ValueError: | 419 except ValueError: |
417 pass | 420 pass |
418 except IOError, e: | 421 except IOError, e: |
419 if e[0] == errno.EINVAL: | 422 if e[0] == errno.EINVAL: |
420 pass | 423 pass |