]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/ceph_daemon.py: _gettermsize fails on non-terminals
authorDan Mick <dan.mick@redhat.com>
Thu, 27 Apr 2017 23:07:22 +0000 (16:07 -0700)
committerDan Mick <dan.mick@redhat.com>
Fri, 28 Apr 2017 00:01:35 +0000 (17:01 -0700)
default to 80x25; this should be for terminalless tests only

Signed-off-by: Dan Mick <dan.mick@redhat.com>
src/pybind/ceph_daemon.py

index 234a1866e6f500d1763db188bf15977663005f08..48bd4e0d7cef66681aadbf44ecbca7d20b8af3d6 100755 (executable)
@@ -88,7 +88,12 @@ def admin_socket(asok_path, cmd, format=''):
 
 
 def _gettermsize():
-    return struct.unpack('hhhh', ioctl(0, TIOCGWINSZ, 8*'\x00'))[0:2]
+    try:
+        rows, cols = struct.unpack('hhhh', ioctl(0, TIOCGWINSZ, 8*'\x00'))[0:2]
+    except IOError:
+        return 25, 80
+
+    return rows,cols
 
 
 class Termsize(object):