Encapsulates the output and error streams of a running process. This is used byscala.sys.process.ProcessBuilder when starting a process, as an alternative toscala.sys.process.ProcessIO, which can be more difficult to use. Note that aProcessLogger will be used to create aProcessIO anyway. The objectBasicIO has some functions to do that.
Here is an example that counts the number of lines in the normal and error output of a process:
import scala.sys.process._var normalLines = 0var errorLines = 0val countLogger = ProcessLogger(line => normalLines += 1, line => errorLines += 1)"find /etc" ! countLoggerIf a process is begun with one of theseProcessBuilder methods:
If a process is begun with one of theseProcessBuilder methods:
def !(log: ProcessLogger): Intdef !<(log: ProcessLogger): IntThe run will be wrapped in a call to buffer. This gives the logger an opportunity to set up and tear down buffering. At present the library implementations ofProcessLogger simply execute the body unbuffered.
Will be called with each line read from the process error stream.
Will be called with each line read from the process error stream.
Will be called with each line read from the process output stream.
Will be called with each line read from the process output stream.