SubprocessBlackbox

class SubprocessBlackbox(processCmd: Array<String>) : Blackbox

Blackbox that launches and wraps a child process, allowing interacting with it using a common interface.

Constructors

SubprocessBlackbox
Link copied to clipboard
fun SubprocessBlackbox(processCmd: Array<String>)

Functions

equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open fun hashCode(): Int
read
Link copied to clipboard
open override fun read(block: Boolean): String
readAll
Link copied to clipboard
open fun readAll(block: Boolean = true, limit: Int = 0): List<String>

Read out all lines up to a limit if given a limit greater than zero.

start
Link copied to clipboard
open override fun start()

Launch the child process.

stop
Link copied to clipboard
open override fun stop(): Exception?

Try to shut down this black box.

toString
Link copied to clipboard
open override fun toString(): String
write
Link copied to clipboard
open override fun write(string: String)

Write a single string to the black box.

Properties

inStream
Link copied to clipboard
var inStream: BufferedReader? = null

STDOUT of the wrapped process, or null.

isAlive
Link copied to clipboard
open override val isAlive: Boolean

Whether this black box is "running", and able to receive and respond to input.

outStream
Link copied to clipboard
var outStream: BufferedWriter? = null

STDIN of the wrapped process, or null.

process
Link copied to clipboard
var process: Process? = null

The wrapped process.

processCmd
Link copied to clipboard
val processCmd: Array<String>

String Array of the command to run to start the child process.

processLaunchFail
Link copied to clipboard
var processLaunchFail: String? = null

Null, or error message string if launching the process produced an exception.

readyForRead
Link copied to clipboard
open override val readyForRead: Int

Approximate number of items ready to be read. Should try to always return 0 correctly, but may return 1 if a greater number of items are available.

readyForWrite
Link copied to clipboard
open override val readyForWrite: Boolean

Whether this black box is ready to be written to.

Sources

jvm source
Link copied to clipboard