]> arthur.barton.de Git - bup.git/commitdiff
options.py: don't die if tty width is set to 0.
authorAvery Pennarun <apenwarr@gmail.com>
Sun, 23 Jan 2011 00:42:32 +0000 (16:42 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Wed, 26 Jan 2011 05:18:56 +0000 (21:18 -0800)
This sometimes happens if weird people, such as myself, open a pty without
setting the width field correctly.

(copied from the sshuttle project)

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
lib/bup/options.py

index 17d1eef88183ace39182d25bd48745c6ff87a871..0c3a59b7586e2136c74b34490d0ae8164ece235e 100644 (file)
@@ -60,7 +60,7 @@ def _tty_width():
     except (IOError, ImportError):
         return _atoi(os.environ.get('WIDTH')) or 70
     (ysize,xsize,ypix,xpix) = struct.unpack('HHHH', s)
-    return xsize
+    return xsize or 70
 
 
 class Options: