Skip to main content
The system API provides a process execution layer for running shell commands, managing their lifecycle, and building pipelines. It is built around three core types: Command (a description of what to run), ProcessHandle (a live process), and Pipeline (composed execution).

Command

Command describes a single executable invocation with arguments, environment, and working directory. The constructor is internal — use the factory functions or the companion method instead.

Creating commands

Factory functions

Command builder methods (return Command for chaining)

Stdin values

Stdio values

Command execution methods

Companion method

Creates a Command that executes script via sh -c.

ProcessHandle

A ProcessHandle represents a running process. It is obtained from Command.spawn() or Command.pipeTo().

ProcessHandle properties

ProcessHandle methods

Collecting output

Pipeline

Pipeline allows composing multiple processes where stdout of one feeds stdin of the next. The constructor is internal — build via Command.pipe() infix.

Creating a pipeline

Pipeline methods

Awaiting pipeline completion

Streaming extensions

The com.klyx.api.system package provides many extension functions for convenient process handling:

Process utilities

Extension functions on Process:

CommandResult

The result of a completed command execution:

ProcessEvent

Events emitted during streaming execution:

Example

Run a command and collect its output:
Run a pipeline:
Stream a process in real time:
Run with a timeout: