Squish: Improve cleanup on Win

Change-Id: If39af63b6b65cb09c351bef6158c8ae8b9837668
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
Christian Stenger
2013-03-05 10:50:36 +01:00
parent 132f0e2bf3
commit cc454d11fc
+15
View File
@@ -61,6 +61,8 @@ def waitForCleanShutdown(timeOut=10):
appCtxt = currentApplicationContext()
shutdownDone = (str(appCtxt)=="")
if platform.system() in ('Windows','Microsoft'):
# cleaning helper for running on the build machines
__checkForQmlViewer__()
endtime = datetime.utcnow() + timedelta(seconds=timeOut)
while not shutdownDone:
# following work-around because os.kill() works for win not until python 2.7
@@ -85,6 +87,19 @@ def waitForCleanShutdown(timeOut=10):
if not shutdownDone and datetime.utcnow() > endtime:
break
def __checkForQmlViewer__():
tasks = subprocess.Popen("tasklist /FI \"IMAGENAME eq qmlviewer.exe\"", shell=True,
stdout=subprocess.PIPE)
output = tasks.communicate()[0]
tasks.stdout.close()
if "INFO: No tasks are running which match the specified criteria." in output:
return
else:
if subprocess.call("taskkill /F /FI \"IMAGENAME eq qmlviewer.exe\"", shell=True) == 0:
print "Killed still running qmlviewer"
else:
print "qmlviewer is still running - failed to kill it"
def __removeTestingDir__():
def __removeIt__(directory):
deleteDirIfExists(directory)