mirror of
https://github.com/geode-sdk/android-launcher.git
synced 2026-10-21 16:32:39 +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
|
||||
fun clearLogcatCrashBuffer(): Boolean {
|
||||
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 {
|
||||
fun getLogcatCrashBuffer(path: String): String {
|
||||
try {
|
||||
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 ->
|
||||
logcatProcess.inputStream.use { input ->
|
||||
input.copyTo(output)
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
return logcatOutput
|
||||
}
|
||||
catch (e: Exception) {
|
||||
Log.e("Geode", "Failed to write logcat crash buffer", e)
|
||||
return false
|
||||
Log.e("Geode", "Failed to get logcat crash buffer", e)
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user