summaryrefslogtreecommitdiffstats
path: root/pym/portage/output.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-07-27 15:09:58 -0700
committerZac Medico <zmedico@gentoo.org>2012-07-27 15:09:58 -0700
commitd4765af29cbadd1d54beacebab3eaae546d31d18 (patch)
treeb4b8bee6a7be53193b7bc54e826052949cd17ab1 /pym/portage/output.py
parentd938c3ff0a4ef92451cf6381aeb23a6c2d9ad8f2 (diff)
downloadportage-d4765af29cbadd1d54beacebab3eaae546d31d18.tar.gz
portage-d4765af29cbadd1d54beacebab3eaae546d31d18.tar.bz2
portage-d4765af29cbadd1d54beacebab3eaae546d31d18.zip
get_term_size: handle temporary stdout overrides
Diffstat (limited to 'pym/portage/output.py')
-rw-r--r--pym/portage/output.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/pym/portage/output.py b/pym/portage/output.py
index b813a3983..da94377b1 100644
--- a/pym/portage/output.py
+++ b/pym/portage/output.py
@@ -425,7 +425,7 @@ class StyleWriter(formatter.DumbWriter):
if self.style_listener:
self.style_listener(styles)
-def get_term_size(fd=sys.stdout):
+def get_term_size(fd=None):
"""
Get the number of lines and columns of the tty that is connected to
fd. Returns a tuple of (lines, columns) or (0, 0) if an error
@@ -434,6 +434,8 @@ def get_term_size(fd=sys.stdout):
greater than or equal to zero, since a negative COLUMNS variable is
known to prevent some commands from working (see bug #394091).
"""
+ if fd is None:
+ fd = sys.stdout
if not hasattr(fd, 'isatty') or not fd.isatty():
return (0, 0)
try: