class ChildProcess
source · line 36public class ChildProcess internal constructor(
inputPipe: Boolean,
outputPipe: Boolean,
errorPipe: Boolean
) : Closeable
- Supertype
Closeable - Inherited
fun dispose(): Unit· Closeable
An owned child process and any untaken pipe endpoints. Close closes retained pipes and waits for termination; it does not automatically kill a running process.
property stdout
source · line 69public val stdout: ByteSource?
get: public read-only
A borrowed view of the child's output pipe, or None when it is not available.
getter get
source · line 69get(): Option<ByteSource>
function tryWait
source · line 121public fun tryWait(): ExitStatus?
Returns a final status if available, or None while the child is still running.
property stderr
source · line 73public val stderr: ByteSource?
get: public read-only
A borrowed view of the child's error pipe, or None when it is not available.
getter get
source · line 73get(): Option<ByteSource>
function takeStderr
source · line 108public fun takeStderr(): PipeSource?
Transfers ownership of the child's error pipe to the caller and removes it from automatic child cleanup.
function wait
source · line 117public fun wait(): ExitStatus
Waits for termination and returns the final status.
function terminate
source · line 178public fun terminate(): Unit
Requests SIGTERM on POSIX or TerminateProcess with exit code 1 on Windows.
function takeStdin
source · line 90public fun takeStdin(): PipeSink?
Transfers ownership of the child's input pipe to the caller and removes it from automatic child cleanup.
property stdin
source · line 65public val stdin: ByteSink?
get: public read-only
A borrowed view of the child's input pipe, or None when it is not available.
getter get
source · line 65get(): Option<ByteSink>
function kill
source · line 184public fun kill(): Unit
Requests forced process termination.
function takeStdout
source · line 99public fun takeStdout(): PipeSource?
Transfers ownership of the child's output pipe to the caller and removes it from automatic child cleanup.
property isClosed
source · line 77public val isClosed: Boolean
get: public read-only
Whether this owned resource has been closed.
getter get
source · line 77get(): Boolean
function communicate
source · line 214public fun communicate(input: List<Byte>? = None): ProcessOutput
Feeds optional input while draining stdout and stderr, then waits and returns their collected bytes and status.
parameter input
source · line 214input: List<Byte>? = None
function close
source · line 285public override fun close(): Unit
- Overrides
close
Closes retained pipe endpoints and waits for the child, preserving cleanup failures. Taken endpoints remain the caller's responsibility.
function communicate
source · line 222public fun communicate(timeout: Duration, input: List<Byte>? = None): ProcessOutput
Uses one monotonic timeout for input, both outputs, and process exit. Negative durations leave the pipes untouched. On timeout, closes the pipes, kills and reaps the owned child, and throws ProcessTimeoutException with the bytes collected so far. Descendant processes are not managed. Cleanup and OS scheduling can delay return beyond the timeout.
parameter timeout
source · line 222timeout: Duration
parameter input
source · line 222input: List<Byte>? = None