Handle IOException in readUnexpectedStderr
This commit is contained in:
@@ -107,6 +107,7 @@ class RootServer {
|
|||||||
if (!this::process.isInitialized) return null
|
if (!this::process.isInitialized) return null
|
||||||
var available = process.errorStream.available()
|
var available = process.errorStream.available()
|
||||||
return if (available <= 0) null else String(ByteArrayOutputStream().apply {
|
return if (available <= 0) null else String(ByteArrayOutputStream().apply {
|
||||||
|
try {
|
||||||
while (available > 0) {
|
while (available > 0) {
|
||||||
val bytes = ByteArray(available)
|
val bytes = ByteArray(available)
|
||||||
val len = process.errorStream.read(bytes)
|
val len = process.errorStream.read(bytes)
|
||||||
@@ -114,6 +115,9 @@ class RootServer {
|
|||||||
write(bytes, 0, len)
|
write(bytes, 0, len)
|
||||||
available = process.errorStream.available()
|
available = process.errorStream.available()
|
||||||
}
|
}
|
||||||
|
} catch (e: IOException) {
|
||||||
|
Logger.me.w("Reading stderr was cut short", e)
|
||||||
|
}
|
||||||
}.toByteArray())
|
}.toByteArray())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user