]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
build: kill stdout in python functions
authorChris Larson <chris_larson@mentor.com>
Fri, 10 Dec 2010 03:47:00 +0000 (22:47 -0500)
committerChris Larson <chris_larson@mentor.com>
Fri, 10 Dec 2010 14:56:15 +0000 (09:56 -0500)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
lib/bb/build.py

index d60146173b28e145ee99cfd6321711a1435ac8c7..e95e358af321a44fc4569ec28bdbc6817e7ba9bb 100644 (file)
@@ -38,7 +38,7 @@ from bb import data, event, mkdirhier, utils
 bblogger = logging.getLogger('BitBake')
 logger = logging.getLogger('BitBake.Build')
 
-NULL = open('/dev/null', 'r')
+NULL = open('/dev/null', 'a')
 
 
 # When we execute a python function we'd like certain things
@@ -205,6 +205,9 @@ def exec_func_python(func, d, runfile, logfile, cwd=None):
     if cwd:
         os.chdir(cwd)
 
+    stdout, stderr = sys.stdout, sys.stderr
+    sys.stdout, sys.stderr = NULL, NULL
+
     handler = logging.StreamHandler(logfile)
     handler.setFormatter(logformatter)
     bblogger.addHandler(handler)
@@ -219,6 +222,7 @@ def exec_func_python(func, d, runfile, logfile, cwd=None):
         raise FuncFailed(func, None)
     finally:
         bblogger.removeHandler(handler)
+        sys.stdout, sys.stderr = stdout, stderr
         os.chdir(olddir)
 
 def exec_func_shell(function, d, runfile, logfile, cwd=None, fakeroot=False):