Add 600ms timeout for waitpid

This commit is contained in:
Max Lv
2017-03-01 09:53:35 +08:00
parent f43362fb18
commit a61b03c86c
3 changed files with 28 additions and 4 deletions
@@ -115,7 +115,12 @@ class GuardedProcess(cmd: String*) {
private def destroyProcess() {
if (Build.VERSION.SDK_INT < 24) {
JniHelper.sigtermCompat(process)
process.waitFor()
var tries = 0
while (JniHelper.waitpidCompat(process) == 0 && tries < 3) {
Log.w(TAG, "still waiting for process " + Commandline.toString(cmd))
Thread.sleep(200)
tries += 1
}
}
process.destroy()
}