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 ...@@ -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)) Crashlytics.log(Log.WARN, TAG, "error occurred. stop guard: " + Commandline.toString(cmd))
GlobalScope.launch(Dispatchers.Main) { onFatal(e) } GlobalScope.launch(Dispatchers.Main) { onFatal(e) }
} finally { } finally {
if (!running) return // process already exited, nothing to be done if (running) withContext(NonCancellable) { // clean-up cannot be cancelled
withContext(NonCancellable) { // clean-up cannot be cancelled
if (Build.VERSION.SDK_INT < 24) { if (Build.VERSION.SDK_INT < 24) {
try { try {
Os.kill(pid.get(process) as Int, OsConstants.SIGTERM) Os.kill(pid.get(process) as Int, OsConstants.SIGTERM)
...@@ -100,7 +99,7 @@ class GuardedProcessPool(private val onFatal: suspend (IOException) -> Unit) : C ...@@ -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 process.destroyForcibly() // Force to kill the process if it's still alive
} }
exitChannel.receive() 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