For consistency with other xterm titles code, redirect $PROMPT_COMMAND output to...
authorZac Medico <zmedico@gentoo.org>
Mon, 11 Jun 2007 08:41:34 +0000 (08:41 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 11 Jun 2007 08:41:34 +0000 (08:41 -0000)
svn path=/main/trunk/; revision=6799

pym/portage/output.py

index deb8c548b36c1035443f6ccd17f0b54c0b467f39..ff960d84329c634ec64dbfd90aebafcf554dcec5 100644 (file)
@@ -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','')