Mercurial > hg-stable
changeset 30325:1ad1c5017043
scmutil: remove superfluous indent from termwidth()
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 20 Oct 2016 21:57:32 +0900 |
parents | 80708959161a |
children | 392633d7860e |
files | mercurial/scmposix.py |
diffstat | 1 files changed, 18 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/scmposix.py Thu Oct 20 21:50:29 2016 +0900 +++ b/mercurial/scmposix.py Thu Oct 20 21:57:32 2016 +0900 @@ -48,25 +48,24 @@ TIOCGWINSZ = termios.TIOCGWINSZ # unavailable on IRIX (issue3449) except (AttributeError, ImportError): return 80 - if True: - for dev in (ui.ferr, ui.fout, ui.fin): + + for dev in (ui.ferr, ui.fout, ui.fin): + try: try: - try: - fd = dev.fileno() - except AttributeError: - continue - if not os.isatty(fd): - continue - if True: - arri = fcntl.ioctl(fd, TIOCGWINSZ, '\0' * 8) - width = array.array('h', arri)[1] - if width > 0: - return width - except ValueError: + fd = dev.fileno() + except AttributeError: + continue + if not os.isatty(fd): + continue + arri = fcntl.ioctl(fd, TIOCGWINSZ, '\0' * 8) + width = array.array('h', arri)[1] + if width > 0: + return width + except ValueError: + pass + except IOError as e: + if e[0] == errno.EINVAL: pass - except IOError as e: - if e[0] == errno.EINVAL: - pass - else: - raise + else: + raise return 80