Kill idb on an exception. Otherwise in case of idb failure, it may not be able to run and install next application.

This commit is contained in:
Pavel Punegov
2020-07-13 19:02:36 +03:00
committed by Pavel Punegov
parent 02ea97b609
commit 3169e3c857
@@ -328,6 +328,8 @@ private fun deviceLauncher(project: Project) = object : ExecutorService {
private val deviceName = project.findProperty("device_name") as? String private val deviceName = project.findProperty("device_name") as? String
override fun execute(action: Action<in ExecSpec>): ExecResult? { override fun execute(action: Action<in ExecSpec>): ExecResult? {
var result: ExecResult? = null
try {
val udid = targetUDID() val udid = targetUDID()
println("Found device UDID: $udid") println("Found device UDID: $udid")
install(udid, xcProject.resolve("build/KonanTestLauncher.ipa").toString()) install(udid, xcProject.resolve("build/KonanTestLauncher.ipa").toString())
@@ -339,7 +341,7 @@ private fun deviceLauncher(project: Project) = object : ExecutorService {
var savedOut: OutputStream? = null var savedOut: OutputStream? = null
val out = ByteArrayOutputStream() val out = ByteArrayOutputStream()
val result = project.exec { execSpec: ExecSpec -> result = project.exec { execSpec: ExecSpec ->
action.execute(execSpec) action.execute(execSpec)
execSpec.executable = "lldb" execSpec.executable = "lldb"
execSpec.args = commands + "-b" + "-o" + "command script import ${pythonScript()}" + execSpec.args = commands + "-b" + "-o" + "command script import ${pythonScript()}" +
@@ -371,7 +373,11 @@ private fun deviceLauncher(project: Project) = object : ExecutorService {
} }
uninstall(udid, bundleId) uninstall(udid, bundleId)
} catch (exc: Exception) {
throw RuntimeException("iOS-device execution failed", exc)
} finally {
kill() kill()
}
return result return result
} }