Process
Process and concurrency primitives — backed by Kex.Intrinsic.Process and the BEAM runtime. Pid is an opaque BEAM process identifier; Task wraps a spawned process with an awaitable result.
type Pid
Methods
sendFrom
sendFrom(msg: X) -> Void
Sends the conventional Erlang sender-bearing pair {Process.self, msg}.
type Task<A>
Methods
type Reference
Methods
type Process<A>
Methods
A spawned Process<X> is a typed process handle backed by the same runtime pid. It therefore supports the ordinary pid lifecycle operations without erasing its message type.
type ProcessExitReason
A process termination reason. This remains open because the BEAM permits any term as an exit reason; conventional values include :normal, :shutdown, and structured application errors.
Variants
Any
record Reply<A>
Describes the transition returned by a synchronous serving slot.
reply answers the caller immediately. A slot may omit it only when it sends a deferred response with from.reply(...). new installs the next serving state; omitting it preserves the current state. stop terminates the server after applying the transition. Within a serving X block, the checker narrows new from Any? to X?.
Fields
replyAnewAny?optionalstopProcessExitReason?optional
type From<A>
Methods
type CallError
Variants
TimeoutNoProcessCallFailed
record Server<X>
Fields
Methods
module Process
spawn
spawn(state: X) -> Server<X>
Starts a process-backed server for the serving implementation attached to X.
run
run(command: String, args: [String]) -> Result<ProcessResult, String>
Run an executable directly with an argv vector. No shell is involved. Output is captured as UTF-8 strings; a non-zero child status is still a successful ProcessResult, while failure to start the child is Error.
stream
stream(command: String, args: [String]) -> Result<Integer, String>
Run an executable with the CALLER's stdout and stderr, so its output appears as it is produced rather than in one block when it exits. Answers the exit code; nothing is captured — that is the trade, and it is what a long-running child a person is watching needs (kexhq/kex#187).
run remains the one to use when the output is data to be READ.
record ProcessResult
Fields
module Task
function worker
worker : Block<Pid> -> (Atom, Block<Pid>)
Wraps a spawn block into a worker spec for Supervisor.start.