Stop python process leaked from test before building envs

This commit is contained in:
Ilya.Kazakevich
2018-02-12 17:02:18 +03:00
parent 1a9188e8ed
commit 213398528d
+16 -1
View File
@@ -110,7 +110,15 @@ envs {
createPython("django_latest", "3.5.3", ["django"], "python3.5\ndjango", true)
}
task prepare (type: Delete) {
/**
* Kills any process named "python" using windows powershell.
* Works on Win7+.
*/
task killPythonWindows(type:Exec) {
commandLine 'powershell', '"Get-Process | where {$_.Name -ieq \\"python\\"} | Stop-Process"'
}
task prepare(type: Delete) {
doFirst {
new File(envs.bootstrapDirectory, "django_latest").with { djangoLatestFolder ->
if (djangoLatestFolder.exists() && djangoLatestFolder.lastModified() < System.currentTimeMillis() - 24 * 60 * 60 * 1000) {
@@ -130,6 +138,13 @@ task prepare (type: Delete) {
}
}
}
prepare.dependsOn {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
// Python leaked from previous test may prevent this script from
// deleting folder because you can't delete file opened by process on Windows
killPythonWindows
}
}
task build {