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