More informative error message

This commit is contained in:
Mygod
2020-08-12 10:37:03 -04:00
parent 44ba43389d
commit 618360a6c9

View File

@@ -145,18 +145,21 @@ class RootServer {
} catch (e: Exception) { } catch (e: Exception) {
throw NoShellException(e) throw NoShellException(e)
} }
try {
val token2 = UUID.randomUUID().toString() val token2 = UUID.randomUUID().toString()
val persistence = File(context.codeCacheDir, ".librootkotlinx-uuid") val persistence = File(context.codeCacheDir, ".librootkotlinx-uuid")
val uuid = context.packageName + '@' + if (persistence.canRead()) persistence.readText() else { val uuid = context.packageName + '@' + if (persistence.canRead()) persistence.readText() else {
UUID.randomUUID().toString().also { persistence.writeText(it) } UUID.randomUUID().toString().also { persistence.writeText(it) }
}
val (script, relocated) = AppProcess.relocateScript(uuid)
script.appendln(AppProcess.launchString(context.packageCodePath, RootServer::class.java.name, relocated,
niceName) + " $token2")
writer.writeBytes(script.toString())
writer.flush()
reader.lookForToken(token2) // wait for ready signal
} catch (e: Exception) {
throw RuntimeException("Failed to launch root daemon", e)
} }
val (script, relocated) = AppProcess.relocateScript(uuid)
script.appendln(AppProcess.launchString(context.packageCodePath, RootServer::class.java.name, relocated,
niceName) + " $token2")
writer.writeBytes(script.toString())
writer.flush()
reader.lookForToken(token2) // wait for ready signal
output = writer output = writer
require(!active) require(!active)
active = true active = true