changeset 3675:f048227cabc3

search index filters: redirect stderr to logging system
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 07 Jun 2008 18:47:58 +0200
parents 8772197c9262
children 8dc2c2fc64ef
files MoinMoin/filter/__init__.py
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/filter/__init__.py	Sat Jun 07 17:35:22 2008 +0200
+++ b/MoinMoin/filter/__init__.py	Sat Jun 07 18:47:58 2008 +0200
@@ -2,11 +2,15 @@
 """
     MoinMoin - Filter Package
 
-    @copyright: 2006 Thomas Waldmann
+    @copyright: 2006-2008 MoinMoin:ThomasWaldmann
     @license: GNU GPL, see COPYING for details.
 """
 
 import os
+
+from MoinMoin import log
+logging = log.getLogger(__name__)
+
 from MoinMoin.util import pysupport
 
 modules = pysupport.getPackageModules(__file__)
@@ -18,9 +22,13 @@
         to decode to unicode, we use the first coding of codings list that
         does not throw an exception or force ascii
     """
-    f = os.popen(cmd % filename)
-    data = f.read()
-    f.close()
+    filter_cmd = cmd % filename
+    child_stdin, child_stdout, child_stderr = os.popen3(filter_cmd)
+    data = child_stdout.read()
+    errors = child_stderr.read()
+    child_stdout.close()
+    child_stderr.close()
+    logging.debug("cmd: %s stderr: %s" % (filter_cmd, errors))
     for c in codings:
         try:
             return data.decode(c)