qemu.py: Add QEMUMachine.exitcode() method

Allow the exit code of QEMU to be queried by scripts.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170526181200.17227-3-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2017-05-26 15:11:59 -03:00
parent 37bbcd5757
commit b2b8d98675

View File

@ -88,6 +88,11 @@ class QEMUMachine(object):
def is_running(self):
return self._popen and (self._popen.returncode is None)
def exitcode(self):
if self._popen is None:
return None
return self._popen.returncode
def get_pid(self):
if not self.is_running():
return None