process
local process = require("@rodeo/process")Summary
Section titled “Summary”| Entry | Description |
|---|---|
| ProcessHandle | Handle to a process started with create. Fields are populated when |
| ProcessResult | Result returned by run and system — exit code plus captured |
| ProcessRunOptions | Options accepted by run, system, and create. All fields optional. |
| StdioKind | How a stdio stream should be wired for a spawned process. "default" |
| args | The command-line arguments passed to this rodeo execution after --. |
| create | Spawns args as a child process without waiting. Returns a handle with |
| cwd | Returns the current working directory. |
| env | A read-only view of environment variables visible to this execution. |
| execpath | Returns the path of the running rodeo binary. |
| exit | Exits the current execution with the given code. |
| homedir | Returns the user’s home directory. |
| kill | Terminates a process started with create. |
| run | Runs args (or an existing handle), blocking until completion. Returns |
| system | Like run, but takes a single shell-style command string. |
ProcessHandle
Section titled “ProcessHandle”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?,}ProcessResult
Section titled “ProcessResult”Result returned by run and system — exit code plus captured
stdout/stderr (when piped).
type ProcessResult = runtime.ProcessRunResponseProcessRunOptions
Section titled “ProcessRunOptions”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 }?,}StdioKind
Section titled “StdioKind”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"Functions and Properties
Section titled “Functions and Properties”process.args
Section titled “process.args”The command-line arguments passed to this rodeo execution after --.
any) :: { string }process.create
Section titled “process.create”Spawns args as a child process without waiting. Returns a handle with
stdin/stdout/stderr stream handles for live interaction.
(args: { string }, options: ProcessRunOptions?) -> ProcessHandleprocess.cwd
Section titled “process.cwd”Returns the current working directory.
() -> stringprocess.env
Section titled “process.env”A read-only view of environment variables visible to this execution.
any) :: { [string]: string? }process.execpath
Section titled “process.execpath”Returns the path of the running rodeo binary.
() -> stringprocess.exit
Section titled “process.exit”Exits the current execution with the given code.
(code: number) -> ()process.homedir
Section titled “process.homedir”Returns the user’s home directory.
() -> stringprocess.kill
Section titled “process.kill”Terminates a process started with create.
(handle: ProcessHandle) -> ()process.run
Section titled “process.run”Runs args (or an existing handle), blocking until completion. Returns
captured stdout/stderr and exit code.
(argsOrHandle: { string } | ProcessHandle, options: ProcessRunOptions?) -> ProcessResultprocess.system
Section titled “process.system”Like run, but takes a single shell-style command string.
(command: string, options: ProcessRunOptions?) -> ProcessResult