Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Scala Sys Process

Tags:

scala

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 ?

like image 393
MaatDeamon Avatar asked Dec 08 '25 22:12

MaatDeamon


1 Answers

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()
    }
  }
}
like image 172
OlivierBlanvillain Avatar answered Dec 12 '25 11:12

OlivierBlanvillain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!