This object contains factories forscala.sys.process.ProcessIO, which can be used to control the I/O of ascala.sys.process.Process when ascala.sys.process.ProcessBuilder is started with therun command.
It also contains some helper methods that can be used to in the creation ofProcessIO.
It is used by other classes in the package in the implementation of various features, but can also be used by client code.
Creates aProcessIO from a functionString => Unit.
Creates aProcessIO from a functionString => Unit. It can attach the process input to stdin, and it will either send the error stream to stderr, or to aProcessLogger.
For example, theProcessIO created below will print all normal output while ignoring all error output. No input will be provided.
import scala.sys.process.BasicIOval errToDevNull = BasicIO(false, println(_), None)An optionalProcessLogger to which the output should be sent. IfNone, output will be sent to stderr.
A function that will be called with the process output.
True if the process input should be attached to stdin.
AProcessIO with the characteristics above.
Creates aProcessIO that appends its output to anAppendable.
Creates aProcessIO that appends its output to anAppendable. It can attach the process input to stdin, and it will either send the error stream to stderr, or to aProcessLogger.
For example, theProcessIO created by the function below will store the normal output on the buffer provided, and print all error on stderr. The input will be read from stdin.
import scala.sys.process.{BasicIO, ProcessLogger}val printer = ProcessLogger(println(_))def appendToBuffer(b: StringBuffer) = BasicIO(true, b, Some(printer))AnAppendable which will receive the process normal output.
An optionalProcessLogger to which the output should be sent. IfNone, output will be sent to stderr.
True if the process input should be attached to stdin.
AProcessIO with the characteristics above.
Creates aProcessIO from aProcessLogger.
Creates aProcessIO from aProcessLogger. It can attach the process input to stdin.
AProcessLogger to receive all output, normal and error.
True if the process input should be attached to stdin.
AProcessIO with the characteristics above.
Closes aCloseable without throwing an exception
Copy contents of stdin to theOutputStream.
Returns a functionInputStream => Unit given an optionalProcessLogger.
Returns a functionInputStream => Unit given an optionalProcessLogger. If no logger is passed, the function will send the output to stderr. This function can be used to create ascala.sys.process.ProcessIO.
An optionalProcessLogger to which the contents of theInputStream will be sent.
A functionInputStream => Unit (used byscala.sys.process.ProcessIO) which will send the data to either the providedProcessLogger or, ifNone, to stderr.
Returns a functionOutputStream => Unit that either reads the content from stdin or does nothing but close the stream.
Returns a functionOutputStream => Unit that either reads the content from stdin or does nothing but close the stream. This function can be used byscala.sys.process.ProcessIO.
Returns a functionInputStream => Unit that appends all data read to the providedAppendable.
Returns a functionInputStream => Unit that appends all data read to the providedAppendable. This function can be used to create ascala.sys.process.ProcessIO. The buffer will be appended line by line.
AnAppendable such asStringBuilder orStringBuffer.
A functionInputStream => Unit (used byscala.sys.process.ProcessIO which will append all data read from the stream to the buffer.
Returns a functionInputStream => Unit that will call the passed function with all data read.
Returns a functionInputStream => Unit that will call the passed function with all data read. This function can be used to create ascala.sys.process.ProcessIO. TheprocessLine function will be called with each line read, andNewline will be appended after each line.
A function that will be called with all data read from the stream.
A functionInputStream => Unit (used byscala.sys.process.ProcessIO which will callprocessLine with all data read from the stream.
CallsprocessLine with the result ofreadLine until the latter returnsnull or the current thread is interrupted.
CallsprocessLine with the result ofreadLine until the latter returnsnull or the current thread is interrupted.
Returns aProcessIO connected to stdout and stderr, and, optionally, stdin.
Returns aProcessIO connected to stdout and stderr, and, optionally, stdin.
Returns aProcessIO connected to stdout, stderr and the providedin
Send all the input from the stream to stderr, and closes the input stream afterwards.
Send all the input from the stream to stderr, and closes the input stream afterwards.
Send all the input from the stream to stdout, and closes the input stream afterwards.
Send all the input from the stream to stdout, and closes the input stream afterwards.
Copy all input from the input stream to the output stream.
Copy all input from the input stream to the output stream. Closes the input stream once it's all read.
Size of the buffer used in all the functions that copy data
Used to separate lines in theprocessFully function that takesAppendable.
Used to separate lines in theprocessFully function that takesAppendable.