From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 565B813800E for ; Fri, 27 Jul 2012 22:10:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2F27DE0655; Fri, 27 Jul 2012 22:10:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id EEF0FE0655 for ; Fri, 27 Jul 2012 22:10:12 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5D4611B4056 for ; Fri, 27 Jul 2012 22:10:12 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 194A5E5436 for ; Fri, 27 Jul 2012 22:10:11 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1343426998.d4765af29cbadd1d54beacebab3eaae546d31d18.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/output.py X-VCS-Directories: pym/portage/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: d4765af29cbadd1d54beacebab3eaae546d31d18 X-VCS-Branch: master Date: Fri, 27 Jul 2012 22:10:11 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 1d0f7988-2f3f-49e6-8546-b9c33660fa66 X-Archives-Hash: 9d33834060407bd9d8c25d2e95defe34 commit: d4765af29cbadd1d54beacebab3eaae546d31d18 Author: Zac Medico gentoo org> AuthorDate: Fri Jul 27 22:09:58 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Jul 27 22:09:58 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d4765af2 get_term_size: handle temporary stdout overrides --- pym/portage/output.py | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/pym/portage/output.py b/pym/portage/output.py index b813a39..da94377 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: