Show More
@@ -48,25 +48,24 b' def termwidth(ui):' | |||||
48 | TIOCGWINSZ = termios.TIOCGWINSZ # unavailable on IRIX (issue3449) |
|
48 | TIOCGWINSZ = termios.TIOCGWINSZ # unavailable on IRIX (issue3449) | |
49 | except (AttributeError, ImportError): |
|
49 | except (AttributeError, ImportError): | |
50 | return 80 |
|
50 | return 80 | |
51 | if True: |
|
51 | ||
52 |
|
|
52 | for dev in (ui.ferr, ui.fout, ui.fin): | |
|
53 | try: | |||
53 | try: |
|
54 | try: | |
54 |
|
|
55 | fd = dev.fileno() | |
55 | fd = dev.fileno() |
|
56 | except AttributeError: | |
56 | except AttributeError: |
|
57 | continue | |
57 | continue |
|
58 | if not os.isatty(fd): | |
58 | if not os.isatty(fd): |
|
59 | continue | |
59 | continue |
|
60 | arri = fcntl.ioctl(fd, TIOCGWINSZ, '\0' * 8) | |
60 | if True: |
|
61 | width = array.array('h', arri)[1] | |
61 | arri = fcntl.ioctl(fd, TIOCGWINSZ, '\0' * 8) |
|
62 | if width > 0: | |
62 | width = array.array('h', arri)[1] |
|
63 | return width | |
63 | if width > 0: |
|
64 | except ValueError: | |
64 | return width |
|
65 | pass | |
65 |
|
|
66 | except IOError as e: | |
|
67 | if e[0] == errno.EINVAL: | |||
66 | pass |
|
68 | pass | |
67 |
e |
|
69 | else: | |
68 | if e[0] == errno.EINVAL: |
|
70 | raise | |
69 | pass |
|
|||
70 | else: |
|
|||
71 | raise |
|
|||
72 | return 80 |
|
71 | return 80 |
General Comments 0
You need to be logged in to leave comments.
Login now