summaryrefslogtreecommitdiffstats
path: root/pym/output.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-07-25 11:16:27 +0000
committerZac Medico <zmedico@gentoo.org>2007-07-25 11:16:27 +0000
commita536b9b733ab4714193c78dfc70369fe28b476f7 (patch)
tree416f018a9713293890beb15aed3cff5c8497044e /pym/output.py
parent41e0a60ce4e867284272a40745d3ea9dd88ab073 (diff)
downloadportage-a536b9b733ab4714193c78dfc70369fe28b476f7.tar.gz
portage-a536b9b733ab4714193c78dfc70369fe28b476f7.tar.bz2
portage-a536b9b733ab4714193c78dfc70369fe28b476f7.zip
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
Diffstat (limited to 'pym/output.py')
-rw-r--r--pym/output.py9
1 files changed, 9 insertions, 0 deletions
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.