summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-06-11 08:41:34 +0000
committerZac Medico <zmedico@gentoo.org>2007-06-11 08:41:34 +0000
commitfee7785e0a5bfc284176f33fb77ecb1a3a820440 (patch)
tree36b62d10fe173877d631947e11465dfd6456c200
parent4908cacd58d2b3eb22a57f1cf9f93115667e2b49 (diff)
downloadportage-fee7785e0a5bfc284176f33fb77ecb1a3a820440.tar.gz
portage-fee7785e0a5bfc284176f33fb77ecb1a3a820440.tar.bz2
portage-fee7785e0a5bfc284176f33fb77ecb1a3a820440.zip
For consistency with other xterm titles code, redirect $PROMPT_COMMAND output to stderr.
svn path=/main/trunk/; revision=6799
-rw-r--r--pym/portage/output.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/pym/portage/output.py b/pym/portage/output.py
index deb8c548b..ff960d843 100644
--- a/pym/portage/output.py
+++ b/pym/portage/output.py
@@ -196,7 +196,16 @@ def xtermTitleReset():
default_xterm_title = ""
elif prompt_command is not None:
if dotitles and "TERM" in os.environ and sys.stderr.isatty():
- os.system(prompt_command)
+ from portage.process import find_binary, spawn
+ shell = os.environ.get("SHELL")
+ if not shell or not os.access(shell, os.EX_OK):
+ shell = find_binary("sh")
+ if shell:
+ spawn([shell, "-c", prompt_command], env=os.environ,
+ fdpipes={0:sys.stdin.fileno(),1:sys.stderr.fileno(),
+ 2:sys.stderr.fileno()})
+ else:
+ os.system(prompt_command)
return
else:
pwd = os.getenv('PWD','')