mirror of
https://github.com/geode-sdk/android-launcher.git
synced 2026-10-21 08:19:33 +00:00
change the output of logcat to not file
This commit is contained in:
1 parent
2500a39133
commit
634c0bc56a
1 file changed
+5
-24
@@ -71,36 +71,17 @@ object GeodeUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun clearLogcatCrashBuffer(): Boolean {
|
fun getLogcatCrashBuffer(path: String): String {
|
||||||
try {
|
|
||||||
val logcatProcess = Runtime.getRuntime().exec("logcat -c -b crash")
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
catch (e: Exception) {
|
|
||||||
Log.e("Geode", "Failed to clear logcat crash buffer", e)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun writeLogcatCrashBuffer(path: String): Boolean {
|
|
||||||
try {
|
try {
|
||||||
val logcatProcess = Runtime.getRuntime().exec("logcat -v brief -b crash -d")
|
val logcatProcess = Runtime.getRuntime().exec("logcat -v brief -b crash -d")
|
||||||
|
|
||||||
val logcatFile = File(path)
|
val logcatOutput = logcatProcess.inputStream.bufferedReader().readText()
|
||||||
|
|
||||||
logcatFile.outputStream().use { output ->
|
return logcatOutput
|
||||||
logcatProcess.inputStream.use { input ->
|
|
||||||
input.copyTo(output)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
catch (e: Exception) {
|
catch (e: Exception) {
|
||||||
Log.e("Geode", "Failed to write logcat crash buffer", e)
|
Log.e("Geode", "Failed to get logcat crash buffer", e)
|
||||||
return false
|
return ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user