Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/
Date: Fri, 27 Jul 2012 22:10:20
Message-Id: 1343426998.d4765af29cbadd1d54beacebab3eaae546d31d18.zmedico@gentoo
1 commit: d4765af29cbadd1d54beacebab3eaae546d31d18
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 27 22:09:58 2012 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 27 22:09:58 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d4765af2
7
8 get_term_size: handle temporary stdout overrides
9
10 ---
11 pym/portage/output.py | 4 +++-
12 1 files changed, 3 insertions(+), 1 deletions(-)
13
14 diff --git a/pym/portage/output.py b/pym/portage/output.py
15 index b813a39..da94377 100644
16 --- a/pym/portage/output.py
17 +++ b/pym/portage/output.py
18 @@ -425,7 +425,7 @@ class StyleWriter(formatter.DumbWriter):
19 if self.style_listener:
20 self.style_listener(styles)
21
22 -def get_term_size(fd=sys.stdout):
23 +def get_term_size(fd=None):
24 """
25 Get the number of lines and columns of the tty that is connected to
26 fd. Returns a tuple of (lines, columns) or (0, 0) if an error
27 @@ -434,6 +434,8 @@ def get_term_size(fd=sys.stdout):
28 greater than or equal to zero, since a negative COLUMNS variable is
29 known to prevent some commands from working (see bug #394091).
30 """
31 + if fd is None:
32 + fd = sys.stdout
33 if not hasattr(fd, 'isatty') or not fd.isatty():
34 return (0, 0)
35 try: