ProcessIO
This class is used to control the I/O of every scala.sys.process.Process. The functions used to create it will be called with the process streams once it has been started. It might not be necessary to use ProcessIO directly -- scala.sys.process.ProcessBuilder can return the process output to the caller, or use a scala.sys.process.ProcessLogger which avoids direct interaction with a stream. One can even use the factories at BasicIO to create a ProcessIO, or use its helper methods when creating one's own ProcessIO.
When creating a ProcessIO, it is important to close all streams when finished, since the JVM might use system resources to capture the process input and output, and will not release them unless the streams are explicitly closed.
ProcessBuilder will call writeInput, processOutput and processError in separate threads, and if daemonizeThreads is true, they will all be marked as daemon threads.
Value parameters
- daemonizeThreads
-
Indicates whether the newly spawned threads that will run
processOutput,processErrorandwriteInputshould be marked as daemon threads. - processError
-
Function that will be called with the
InputStreamfrom which all error output of the process must be read from. This will be called in a newly spawned thread. - processOutput
-
Function that will be called with the
InputStreamfrom which all normal output of the process must be read from. This will be called in a newly spawned thread. - writeInput
-
Function that will be called with the
OutputStreamto which all input to the process must be written. This will be called in a newly spawned thread.
Attributes
- Note
-
Failure to close the passed streams may result in resource leakage.
- Source
- ProcessIO.scala
- Graph
-
- Supertypes