Commit | Line | Data |
---|---|---|
6f194a1e LC |
1 | Gracefully deal with 'stty size' failures. |
2 | Submitted upstream. | |
3 | ||
4 | --- pybugz-0.6.11/bugz.py 2006-09-02 14:35:37.000000000 +0200 | |
5 | +++ pybugz-0.6.11/bugz.py 2014-05-05 15:17:03.000000000 +0200 | |
6 | @@ -288,7 +288,12 @@ def get_cols(): | |
7 | stty = which('stty') | |
8 | if stty: | |
9 | row_cols = commands.getoutput("%s size" % stty) | |
10 | - rows, cols = map(int, row_cols.split()) | |
11 | + try: | |
12 | + rows, cols = map(int, row_cols.split()) | |
13 | + except: | |
14 | + # In some cases 'stty size' will just fail with | |
15 | + # "Inappropriate ioctl for device". | |
16 | + cols = DEFAULT_NUM_COLS | |
17 | return cols | |
18 | else: | |
19 | return DEFAULT_NUM_COLS |