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):
|
||||
"""Clean up and shut down the process."""
|
||||
self.proc.terminate()
|
||||
self.proc.waitForFinished()
|
||||
if not self.is_running():
|
||||
return
|
||||
|
||||
if quteutils.is_windows:
|
||||
self.proc.kill()
|
||||
else:
|
||||
self.proc.terminate()
|
||||
|
||||
ok = self.proc.waitForFinished()
|
||||
assert ok
|
||||
|
||||
def is_running(self):
|
||||
"""Check if the process is currently running."""
|
||||
|
Loading…
Reference in New Issue
Block a user