MaatDeamon
MaatDeamon

Reputation: 9761

Using Scala Sys Process

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 ?

Upvotes: 3

Views: 70

Answers (1)

OlivierBlanvillain
OlivierBlanvillain

Reputation: 7768

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()
    }
  }
}

Upvotes: 3

Related Questions