title: Stream stdout from scala Process
body: <p>I am using scala Process to kick off a python program and using ProcessLogger to capture the stdout from the python program. I see that the print statements in the python program are printed only after the python program completes. Is there a way to stream the python print statements as they are executed ?</p>
  
  <pre><code>import scala.sys.process.{ProcessLogger, _}
  
  object TestProcessStdOut {
    def main(args: Array[String]) {
      var cmd = "python python_test.py";
      val process = Process(cmd).run(new ProcessLogger {
        override def out(s: =&gt; String) = println(s)
  
        override def buffer[T](f: =&gt; T) = ???
  
        override def err(s: =&gt; String) = ???
      })
    }
  }
  </code></pre>
  
  <p>python_test.py</p>
  
  <pre><code>import time
  
  print("print data 1")
  time.sleep(2)
  print("print data 2")
  time.sleep(2)
  print("print data 3")
  time.sleep(2)
  </code></pre>