elog/mod_echo: send all msg types to stdout
authorZac Medico <zmedico@gentoo.org>
Sat, 3 Sep 2011 23:11:10 +0000 (16:11 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 3 Sep 2011 23:11:10 +0000 (16:11 -0700)
pym/portage/elog/mod_echo.py

index 5de25bf0afdd020888cf0fdfa1d13ca249a37fd0..59117beb318340690a2f8e183afde978a9df879f 100644 (file)
@@ -18,6 +18,19 @@ def process(mysettings, key, logentries, fulltext):
        _items.append((mysettings["ROOT"], key, logentries))
 
 def finalize():
+       # For consistency, send all message types to stdout.
+       sys.stdout.flush()
+       sys.stderr.flush()
+       stderr = sys.stderr
+       try:
+               sys.stderr = sys.stdout
+               _finalize()
+       finally:
+               sys.stderr = stderr
+               sys.stdout.flush()
+               sys.stderr.flush()
+
+def _finalize():
        global _items
        printer = EOutput()
        for root, key, logentries in _items: