Skip to content
Permalink
Browse files

driver: qemudriver: raise meaningful exception if QEMU process termin…

…ated

Signed-off-by: Bastian Krause <bst@pengutronix.de>
  • Loading branch information
Bastian-Krause authored and Emantor committed Jan 6, 2020
1 parent f39f330 commit 437a8476e7d1553949af1205d2d705190c221f04
Showing with 10 additions and 2 deletions.
  1. +10 −2 labgrid/driver/qemudriver.py
@@ -17,7 +17,7 @@
from ..step import step
from .common import Driver
from .consoleexpectmixin import ConsoleExpectMixin
from ..util.qmp import QMPMonitor
from ..util.qmp import QMPMonitor, QMPError
from .exception import ExecutionError


@@ -182,7 +182,15 @@ def on(self):
self._clientsocket, address = self._socket.accept()
self._clientsocket.setblocking(0)
self.logger.debug("new connection from %s", address)
self.qmp = QMPMonitor(self._child.stdout, self._child.stdin)

try:
self.qmp = QMPMonitor(self._child.stdout, self._child.stdin)
except QMPError as exc:
if self._child.poll() is not None:
raise IOError("QEMU process terminated with exit code {}"
.format(self._child.returncode)) from exc
raise

self.status = 1
self.monitor_command("cont")

0 comments on commit 437a847

Please sign in to comment.
You can’t perform that action at this time.