Skip to content

Commit b690b0d

Browse files
committed
Merge pull request #387 from dnephin/make_ps_work_on_jekins
tty width on jenkins
2 parents 1346805 + b0f398c commit b690b0d

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

fig/cli/formatter.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44
import texttable
55

66

7+
def get_tty_width():
8+
tty_size = os.popen('stty size', 'r').read().split()
9+
if len(tty_size) != 2:
10+
return 80
11+
_, width = tty_size
12+
return width
13+
14+
715
class Formatter(object):
816
def table(self, headers, rows):
9-
height, width = os.popen('stty size', 'r').read().split()
10-
11-
table = texttable.Texttable(max_width=width)
17+
table = texttable.Texttable(max_width=get_tty_width())
1218
table.set_cols_dtype(['t' for h in headers])
1319
table.add_rows([headers] + rows)
1420
table.set_deco(table.HEADER)

0 commit comments

Comments
 (0)