]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Added a terminal width fallback
authorArmin Ronacher <armin.ronacher@active-4.com>
Sat, 6 Jul 2013 12:40:29 +0000 (14:40 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Sat, 6 Jul 2013 12:40:29 +0000 (14:40 +0200)
scripts/download_import_cldr.py

index da4c1efb6bcf98b39b91c006a1ee7beb9d09047e..b60a0e40df5b2cb5ec8f291cbce62d9a4fd447ec 100755 (executable)
@@ -16,12 +16,15 @@ BLKSIZE = 131072
 
 
 def get_terminal_width():
-    import fcntl
-    import termios
-    import struct
-    fd = sys.stdin.fileno()
-    cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
-    return cr[1]
+    try:
+        import fcntl
+        import termios
+        import struct
+        fd = sys.stdin.fileno()
+        cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
+        return cr[1]
+    except Exception:
+        return 80
 
 
 def reporthook(block_count, block_size, total_size):