From a536b9b733ab4714193c78dfc70369fe28b476f7 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 25 Jul 2007 11:16:27 +0000 Subject: Merge the portage.spawn() implementation with pty logging from trunk: - Sending output through the pty device makes logging compatible with sesandbox and the default selinux security policy (see bug #162404). - Having a pty device for stdout makes $PAGER behave nicely for things like check_license() from eutils.eclass. svn path=/main/branches/2.1.2/; revision=7395 --- pym/output.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'pym/output.py') diff --git a/pym/output.py b/pym/output.py index 6ac6da3fe..08e4d8401 100644 --- a/pym/output.py +++ b/pym/output.py @@ -332,6 +332,15 @@ def get_term_size(): pass return -1, -1 +def set_term_size(lines, columns, fd): + """ + Set the number of lines and columns for the tty that is connected to fd. + For portability, this simply calls `stty rows $lines columns $columns`. + """ + from portage_exec import spawn + cmd = ["stty", "rows", str(lines), "columns", str(columns)] + spawn(cmd, env=os.environ, fd_pipes={0:fd}) + class EOutput: """ Performs fancy terminal formatting for status and informational messages. -- cgit v1.2.3-1-g7c22