Probable fix for an Issue #908

This commit is contained in:
Miroslav Stampar 2014-11-07 15:47:42 +01:00
parent d087565051
commit 8fdf9ff746

View File

@ -1693,12 +1693,13 @@ def getConsoleWidth(default=80):
width = int(os.getenv("COLUMNS"))
else:
try:
process = execute("stty size", shell=True, stdout=PIPE, stderr=PIPE)
stdout, _ = process.communicate()
items = stdout.split()
with open(os.devnull, 'w') as FNULL:
process = execute("stty size", shell=True, stdout=PIPE, stderr=FNULL)
stdout, _ = process.communicate()
items = stdout.split()
if len(items) == 2 and items[1].isdigit():
width = int(items[1])
if len(items) == 2 and items[1].isdigit():
width = int(items[1])
except OSError:
pass