]> Git Repo - qemu.git/commitdiff
qemu.py: fix is_running() return before first launch()
authorAmador Pahim <[email protected]>
Fri, 1 Sep 2017 11:28:17 +0000 (13:28 +0200)
committerEduardo Habkost <[email protected]>
Fri, 15 Sep 2017 23:12:00 +0000 (20:12 -0300)
is_running() returns None when called before the first time we
call launch():

    >>> import qemu
    >>> vm = qemu.QEMUMachine('qemu-system-x86_64')
    >>> vm.is_running()
    >>>

It should return False instead. This patch fixes that.

For consistence, this patch removes the parenthesis from the
second clause as it's not really needed.

Signed-off-by: Amador Pahim <[email protected]>
Message-Id: <20170901112829[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
scripts/qemu.py

index 7c6802609a2fd1d6e9eee3a6a62a39dc3cd6386a..f80b008f7f1c06238c7116d163c6a3b72e161a93 100644 (file)
@@ -131,7 +131,7 @@ class QEMUMachine(object):
             raise
 
     def is_running(self):
-        return self._popen and (self._popen.returncode is None)
+        return self._popen is not None and self._popen.returncode is None
 
     def exitcode(self):
         if self._popen is None:
This page took 0.036408 seconds and 4 git commands to generate.