Improve terminating of test processes
There are various small changes here: - If the process is already finished, we don't try to terminate it. - On Windows, we use QProcess::kill instead of QProcess::terminate, as terminate will only work with processes which have a GUI loop. - We assert that quitting the suprocess actually worked. Fixes #3384
This commit is contained in:
parent
6655793e6a
commit
2e8acf4825
@ -300,8 +300,16 @@ class Process(QObject):
|
|||||||
|
|
||||||
def terminate(self):
|
def terminate(self):
|
||||||
"""Clean up and shut down the process."""
|
"""Clean up and shut down the process."""
|
||||||
|
if not self.is_running():
|
||||||
|
return
|
||||||
|
|
||||||
|
if quteutils.is_windows:
|
||||||
|
self.proc.kill()
|
||||||
|
else:
|
||||||
self.proc.terminate()
|
self.proc.terminate()
|
||||||
self.proc.waitForFinished()
|
|
||||||
|
ok = self.proc.waitForFinished()
|
||||||
|
assert ok
|
||||||
|
|
||||||
def is_running(self):
|
def is_running(self):
|
||||||
"""Check if the process is currently running."""
|
"""Check if the process is currently running."""
|
||||||
|
Loading…
Reference in New Issue
Block a user