summaryrefslogtreecommitdiffstats
path: root/lib/bb/server
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-12-10 10:37:11 -0700
committerChris Larson <chris_larson@mentor.com>2010-12-16 10:39:27 -0700
commit416dfe211ff0c37d746efe113bb6064b7e57d43a (patch)
tree74d391596ca2c238e3582a2ba60dc7d3665f51ad /lib/bb/server
parent588d339f2bde8ab6547bc0c1c4e7b83310b1318f (diff)
downloadbitbake-416dfe211ff0c37d746efe113bb6064b7e57d43a.tar.gz
server: kill stdin/stdout/stderr
This ensures that nothing run from the server can touch the console, in particular event handlers and python tasks, both of which can use bb.msg or the bitbake loggers to send output to the UI in a correct fashion instead. Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb/server')
-rw-r--r--lib/bb/server/process.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index f3ad5da60..12e099a95 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -22,6 +22,7 @@
import logging
import signal
+import sys
import time
import bb
import bb.event
@@ -29,6 +30,7 @@ from multiprocessing import Process, Event
from bb.cooker import BBCooker
logger = logging.getLogger('BitBake')
+NULL = open('/dev/null', 'a')
class ServerCommunicator():
def __init__(self, connection):
@@ -86,6 +88,13 @@ class ProcessServer(Process):
self._idlefunctions[function] = data
def run(self):
+ """Run the server, killing off stdin/stdout/stderr"""
+ with bb.utils.redirected_fds([sys.stdin, sys.stdout, sys.stderr],
+ [NULL, NULL, NULL]):
+ return self.main()
+
+ def main(self):
+ """Server main loop"""
# Ensure logging messages get sent to the UI as events
logger.addHandler(bb.event.LogHandler())
@@ -105,7 +114,6 @@ class ProcessServer(Process):
self.event_queue.cancel_join_thread()
bb.event.unregister_UIHhandler(self.event_handle)
self.command_channel.close()
- return
def idle_commands(self, delay):
nextsleep = delay