From 3b06665c9fa92fec54cbb98d89ee30cceb36be4a Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sat, 8 Nov 2014 21:22:03 +0100 Subject: [PATCH] Patch for an Issue #910 --- lib/core/common.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index eec126bc5..12f42a676 100755 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1693,13 +1693,16 @@ def getConsoleWidth(default=80): width = int(os.getenv("COLUMNS")) else: try: - with open(os.devnull, 'w') as FNULL: - process = execute("stty size", shell=True, stdout=PIPE, stderr=FNULL) - stdout, _ = process.communicate() - items = stdout.split() + try: + FNULL = open(os.devnull, 'w') + except IOError: + FNULL = None + process = execute("stty size", shell=True, stdout=PIPE, stderr=FNULL or PIPE) + 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