Prevent OOMs when exporting debug information

This commit is contained in:
Mygod
2018-12-14 01:12:27 +08:00
parent 366ae7dab6
commit cebc807c18

View File

@@ -99,8 +99,12 @@ class SettingsPreferenceFragment : PreferenceFragmentCompat() {
|logcat -d |logcat -d
""".trimMargin()) """.trimMargin())
try { try {
out.write(RootSession.use { it.execQuiet(commands.toString(), true).out.joinToString("\n") } RootSession.use {
.toByteArray()) for (line in it.execQuiet(commands.toString(), true).out) {
out.write(line.toByteArray())
out.write(10) // line break
}
}
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace(writer) e.printStackTrace(writer)
writer.flush() writer.flush()