Skip to content

process

local process = require("@rodeo/process")
EntryDescription
ProcessHandleHandle to a process started with create. Fields are populated when
ProcessResultResult returned by run and system — exit code plus captured
ProcessRunOptionsOptions accepted by run, system, and create. All fields optional.
StdioKindHow a stdio stream should be wired for a spawned process. "default"
argsThe command-line arguments passed to this rodeo execution after --.
createSpawns args as a child process without waiting. Returns a handle with
cwdReturns the current working directory.
envA read-only view of environment variables visible to this execution.
execpathReturns the path of the running rodeo binary.
exitExits the current execution with the given code.
homedirReturns the user’s home directory.
killTerminates a process started with create.
runRuns args (or an existing handle), blocking until completion. Returns
systemLike run, but takes a single shell-style command string.

Handle to a process started with create. Fields are populated when

the corresponding stdio is "piped"; otherwise nil.

type ProcessHandle = {
__rodeo_pid: string,
stdin: stream.StreamHandle?,
stdout: stream.StreamHandle?,
stderr: stream.StreamHandle?,
}

Result returned by run and system — exit code plus captured

stdout/stderr (when piped).

type ProcessResult = runtime.ProcessRunResponse

Options accepted by run, system, and create. All fields optional.

stdio applies to all three streams; per-stream overrides win.

type ProcessRunOptions = {
cwd: string?,
stdio: StdioKind?,
stdin: StdioKind?,
stdout: StdioKind?,
stderr: StdioKind?,
env: { [string]: string }?,
}

How a stdio stream should be wired for a spawned process. "default"

uses the parent’s stream, "piped" captures into a StreamHandle,

"inherit" passes through, "none" discards, "tee" mirrors to both

a capture and the parent’s stream.

type StdioKind = "default" | "piped" | "inherit" | "none" | "tee"

The command-line arguments passed to this rodeo execution after --.

any) :: { string }

Spawns args as a child process without waiting. Returns a handle with

stdin/stdout/stderr stream handles for live interaction.

(args: { string }, options: ProcessRunOptions?) -> ProcessHandle

Returns the current working directory.

() -> string

A read-only view of environment variables visible to this execution.

any) :: { [string]: string? }

Returns the path of the running rodeo binary.

() -> string

Exits the current execution with the given code.

(code: number) -> ()

Returns the user’s home directory.

() -> string

Terminates a process started with create.

(handle: ProcessHandle) -> ()

Runs args (or an existing handle), blocking until completion. Returns

captured stdout/stderr and exit code.

(argsOrHandle: { string } | ProcessHandle, options: ProcessRunOptions?) -> ProcessResult

Like run, but takes a single shell-style command string.

(command: string, options: ProcessRunOptions?) -> ProcessResult