testprocess: Restart process when it quits.

This commit is contained in:
Florian Bruhin 2015-10-10 18:17:07 +02:00
parent f858af666f
commit e6ee0c08cf

View File

@ -30,6 +30,13 @@ class InvalidLine(Exception):
pass
class ProcessExited(Exception):
"""Raised when the child process did exit."""
pass
class Process(QObject):
"""Abstraction over a running test subprocess process.
@ -115,6 +122,10 @@ class Process(QObject):
unexpected output lines earlier.
"""
self._data.clear()
if self.proc.state() != QProcess.Running:
print("Restarting process...")
self.start()
raise ProcessExited
if self._invalid:
raise InvalidLine