When runqemu fails, qemu-system process would keep running
and won't be killed, setpgrp() was used when runqemu was
a shell script but it seems it doesn't work always with python.
This would kill qemu-system explicity and to avoid leaving
it behind.
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
bb.plain(msg)
else:
bb.fatal("%s - FAILED - check the task log and the ssh log" % pn)
+ except BlockingIOError as err:
+ bb.error('runqemu failed, shutting down...')
finally:
signal.signal(signal.SIGTERM, tc.origsigtermhandler)
target.stop()
def stop(self):
self.stop_thread()
+ self.stop_qemu_system()
if hasattr(self, "origchldhandler"):
signal.signal(signal.SIGCHLD, self.origchldhandler)
if self.runqemu:
self.qemupid = None
self.ip = None
+ def stop_qemu_system(self):
+ if self.qemupid:
+ try:
+ # qemu-system behaves well and a SIGTERM is enough
+ os.kill(self.qemupid, signal.SIGTERM)
+ except ProcessLookupError as e:
+ logger.warn('qemu-system ended unexpectedly')
+
def stop_thread(self):
if self.thread and self.thread.is_alive():
self.thread.stop()