summaryrefslogtreecommitdiffstats
path: root/bin/bitbake
diff options
context:
space:
mode:
authorBob Foerster <robert@erafx.com>2010-11-26 16:15:36 -0500
committerChris Larson <chris_larson@mentor.com>2010-12-16 10:39:27 -0700
commit588d339f2bde8ab6547bc0c1c4e7b83310b1318f (patch)
tree06fdc72fbab138d806ab72b7800d3367edad8af5 /bin/bitbake
parentbdd7813d8eecf7b6b636322e748ca6bf69118513 (diff)
downloadbitbake-588d339f2bde8ab6547bc0c1c4e7b83310b1318f.tar.gz
server: fix interrupt handling for process
SIGINT is now blocked within the server context, thus allowing the UI to fully handle all user interaction. There is no longer a need to check for KeyboardInterrupt Exceptions anywhere within the server context. Signed-off-by: Bob Foerster <robert@erafx.com> Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'bin/bitbake')
-rwxr-xr-xbin/bitbake23
1 files changed, 12 insertions, 11 deletions
diff --git a/bin/bitbake b/bin/bitbake
index 346ce9bea..2cf131db8 100755
--- a/bin/bitbake
+++ b/bin/bitbake
@@ -29,6 +29,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)),
import optparse
import warnings
+import signal
from traceback import format_exception
try:
import bb
@@ -39,21 +40,14 @@ import bb.msg
from bb import cooker
from bb import ui
from bb import server
-from bb.server.process import ProcessServer
+from bb.server.process import ProcessServer, ServerCommunicator
from multiprocessing import Queue, Pipe
__version__ = "1.11.0"
logger = logging.getLogger("BitBake")
-class ServerCommunicator():
- def __init__(self, connection):
- self.connection = connection
- def runCommand(self, command):
- # @todo try/except
- self.connection.send(command)
- return self.connection.recv()
class BBConfiguration(object):
"""
@@ -196,14 +190,21 @@ Default BBFILES are the .bb files in the current directory.""")
server.start()
try:
- return ui_main(server_connection.connection, server_connection.events)
+ return ui_main(ServerCommunicator(ui_channel), event_queue)
finally:
+ # the server is stopping, so don't let the user do crazy things with
+ # extra Ctrl-C invocations. If the server does hang, however, the user
+ # won't be able to kill us.
+ #
+ # @todo come up with better mechanism - may need to catch KeyboardInterrupt
+ # here and do a server.terminate()
+ signal.signal(signal.SIGINT, signal.SIG_IGN)
server.stop()
+ server.join()
ui_channel.close()
event_queue.close()
- server.join()
- return return_value
+ return 1
if __name__ == "__main__":
try: