Commit 802d7604 authored by Mygod's avatar Mygod

Fix ReturnFromFinally

parent 689f1b22
......@@ -84,8 +84,7 @@ class GuardedProcessPool(private val onFatal: suspend (IOException) -> Unit) : C
Crashlytics.log(Log.WARN, TAG, "error occurred. stop guard: " + Commandline.toString(cmd))
GlobalScope.launch(Dispatchers.Main) { onFatal(e) }
} finally {
if (!running) return // process already exited, nothing to be done
withContext(NonCancellable) { // clean-up cannot be cancelled
if (running) withContext(NonCancellable) { // clean-up cannot be cancelled
if (Build.VERSION.SDK_INT < 24) {
try {
Os.kill(pid.get(process) as Int, OsConstants.SIGTERM)
......@@ -100,7 +99,7 @@ class GuardedProcessPool(private val onFatal: suspend (IOException) -> Unit) : C
process.destroyForcibly() // Force to kill the process if it's still alive
}
exitChannel.receive()
}
} // otherwise process already exited, nothing to be done
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment