fix: Use Process.errorStream instead of errorReader because the latter is not supported on Android

This commit is contained in:
Artem Chepurnoy 2024-01-14 12:28:38 +02:00
parent ef075b6d13
commit c2f0a81e8a
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
1 changed files with 5 additions and 1 deletions

View File

@ -89,7 +89,11 @@ private suspend fun executeCommand(array: Array<String>) {
Runtime.getRuntime().exec(array)
}
coroutineScope {
val errorText = process.errorReader().readText()
val errorText = runCatching {
process.errorStream.reader().use {
it.readText()
}.trim()
}.getOrNull()
val exitCode = process.waitFor()
if (exitCode != 0) {