3

is there a way to retrieve the actual java inputStream that correspond to the stdout of the java process being executed, when using ProcessBuilder or anything else in the package ?

MaatDeamon
  • 9,532
  • 9
  • 60
  • 127
  • I commented on [this thread](https://stackoverflow.com/questions/46026785/how-to-issue-a-command-that-produces-infinite-output-and-return-immediately/46028869?noredirect=1#comment79160493_46028869) regarding your question – pedromss Sep 07 '17 at 17:17
  • Yes so it thank you – MaatDeamon Sep 07 '17 at 18:13
  • I don't like it so much because the way to hook that to akka stream would be actually to create your stream inside ProcessIO – MaatDeamon Sep 08 '17 at 00:46

1 Answers1

3

Sure, just "use java":

import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader

object Main {
  def main(args: Array[String]) {
    var br: BufferedReader = null
    try {
      br = new BufferedReader(new InputStreamReader(System.in))
      while (true) {
        val input = br.readLine()
      }
    } finally {
      br.close()
    }
  }
}
OlivierBlanvillain
  • 7,701
  • 4
  • 32
  • 51