com.avito.utils.CLIOutputReaderTask.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of process Show documentation
Show all versions of process Show documentation
Collection of infrastructure libraries and gradle plugins of Avito Android project
package com.avito.utils
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.concurrent.Callable
internal class CLIOutputReaderTask(
private val stdout: InputStream
) : Callable {
override fun call(): String {
val result = StringBuilder()
val stdoutBuffer = BufferedReader(InputStreamReader(stdout))
while (true) {
val line = stdoutBuffer.readLine()
if (line != null) {
result.appendLine(line)
} else {
break
}
}
return result.toString().trim()
}
}