qemurunner: Handle qemu start failure correctly

If qemu didn't start correctly, we may not have registered the child
signal. This results in a nasty traceback which confuses the underlying
issue. Cleanup this code and make the handler cleanup conditional.

(From OE-Core rev: 0ead936925c61aaaa7a819f6c5b999ba3a4daeda)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2015-09-26 17:49:25 +01:00
parent 79e3418cad
commit 3408d0dc87

View File

@@ -258,8 +258,9 @@ class QemuRunner:
def stop(self):
self.stop_thread()
if self.runqemu:
if hasattr(self, "origchldhandler"):
signal.signal(signal.SIGCHLD, self.origchldhandler)
if self.runqemu:
os.kill(self.monitorpid, signal.SIGKILL)
logger.info("Sending SIGTERM to runqemu")
try:
@@ -279,7 +280,6 @@ class QemuRunner:
self.server_socket = None
self.qemupid = None
self.ip = None
signal.signal(signal.SIGCHLD, self.origchldhandler)
def stop_thread(self):
if self.thread and self.thread.is_alive():