I want to search logcat for a specific keyword using grep:
ProcessBuilder(
listOf("logcat", "-d", "|", "grep", "<regex-match>")
).start().inputStream.use {
BufferedReader(InputStreamReader(it)).forEachLine {
...
}
}
But, I later found that this isn't really working, reason being that pipe results in another process. JDK 9 offers startPipeline() method as a way to counter this.
I don't see my android build with this API. Given upgrading JDK version is a long process in my case (if possible), is there a method to achieve the same result with current APIs?
PS: I tried looping though output of "logcat -d" and filtering, but that takes too much time.