proc.call() and streams #151
-
Currently, What about if I want to feed stdin of a process via an Certainly, I could use an Scala library has this useful class with no counterpart in ProcessIO(in: (OutputStream) => Unit], out: (InputStream) => Unit, err: (InputStream) => Unit) https://www.scala-lang.org/api/2.13.3/scala/sys/process/ProcessIO.html |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Solved by creating an adapter to def writeToOutputStream(out: OutputStream) = ...
class AdapterToWritable extends geny.Writable {
override def writeBytesTo(os: OutputStream) = writeToOutputStream(os)
} and then using it: proc("myproc").call(stdin=new AdapterToWritable()) |
Beta Was this translation helpful? Give feedback.
Solved by creating an adapter to
Writable
from a funcion that writes to anOutputStream
:and then using it: