Types

Link copied to clipboard
class Builder(val command: String)

Creates a new Process.

Link copied to clipboard
object Current

Information about the current process (i.e. the "parent" process).

Properties

Link copied to clipboard
@JvmField
val args: List<String>

Optional arguments being executed.

Link copied to clipboard
@JvmField
val command: String

The command being executed.

Link copied to clipboard
@JvmField
val cwd: File?

The current working directory, or null if one was not set via io.matthewnelson.kmp.process.changeDir.

Link copied to clipboard
@JvmField
val destroySignal: Signal

The Signal utilized to stop the process (if not already stopped) when destroy is called.

Link copied to clipboard
@JvmField
val environment: Map<String, String>

The environment that was passed.

Link copied to clipboard
@JvmField
val input: AsyncWriteStream?

A stream to write data to the process's standard input, or null if Stdio.Config.stdin is not Stdio.Pipe.

Link copied to clipboard
@get:JvmName(name = "isAlive")
val isAlive: Boolean

Checks if the Process is still running

Link copied to clipboard
@JvmField
@Volatile
protected var isDestroyed: Boolean
Link copied to clipboard
@JvmField
val startTime: ComparableTimeMark

The "rough" start time mark of the Process. This is actually a time mark for when Process was instantiated, which for all platforms is immediately after the underlying platform's process implementation was created.

Link copied to clipboard
@JvmField
val stdio: Stdio.Config

The I/O configuration of the process.

Functions

Link copied to clipboard

Destroys the Process by:

Link copied to clipboard
fun exitCode(): Int

Returns the exit code for which the process completed with.

Link copied to clipboard
abstract fun exitCodeOrNull(): Int?

Returns the exit code for which the process completed with, or null if it has not exited yet.

Link copied to clipboard
abstract fun pid(): Int

Returns the Process identifier (PID).

Link copied to clipboard

Attaches a single OutputFeed to obtain stderr output.

fun stderrFeed(vararg feeds: OutputFeed): Process

Attaches multiple OutputFeed to obtain stderr output. This is handy at Process startup such that no data is missed if there are multiple feeds needing to be attached.

Link copied to clipboard

Returns a Waiter for stderr in order to await any final asynchronous output after resource closure occurs.

Link copied to clipboard

Attaches a single OutputFeed to obtain stdout output.

fun stdoutFeed(vararg feeds: OutputFeed): Process

Attaches multiple OutputFeed to obtain stdout output. This is handy at Process startup such that no data is missed if there are multiple feeds needing to be attached.

Link copied to clipboard

Returns a Waiter for stdout in order to await any final asynchronous output after resource closure occurs.

Link copied to clipboard
suspend fun waitForAsync(): Int

Delays the current coroutine until Process completion.

suspend fun waitForAsync(duration: Duration): Int?

Delays the current coroutine for the specified duration, or until Process.exitCode is available (i.e. the Process completed).