Tea
DocsPlaygroundExamplesReferenceCommunity
GitHub

Tea Language

A strongly typed scripting language for native tools.

© 2026 Tea Language.

ContributingCommunityRepository

Language Runtime

Built-ins

Standard Library

std.argsstd.assertstd.audiostd.envstd.fsstd.httpstd.netstd.jsonstd.parsestd.pathstd.processstd.regexstd.stringstd.timestd.url

Standard Library

std.process

Process execution for running subprocesses and capturing their output.

Exported functions

pub def new_run_options_with(env: Dict[String, String], cwd: String?, stdin: String?, check_enabled: Bool) -> RunOptions

Create run options with explicit env, cwd, stdin, and check settings.

pub def new_run_options() -> RunOptions

Create default run options with no env/cwd/stdin overrides.

pub def new_run_bytes_options_with(env: Dict[String, String], cwd: String?, stdin: List[Int]?, check_enabled: Bool) -> RunBytesOptions

Create byte-oriented run options with explicit env, cwd, stdin, and check settings.

pub def new_run_bytes_options() -> RunBytesOptions

Create default byte-oriented run options with no env/cwd/stdin overrides.

pub def new_spawn_options_with(env: Dict[String, String], cwd: String?) -> SpawnOptions

Create spawn options with explicit env and cwd settings.

pub def new_spawn_options() -> SpawnOptions

Create default spawn options with no env or cwd overrides.

pub def run(command: String, args: List[String]) -> ProcessResult

Run a command synchronously and wait for it to complete.

pub def run_bytes(command: String, args: List[String]) -> ProcessBytesResult

Run a command synchronously and capture stdout/stderr as raw bytes.

pub def run_with(command: String, args: List[String], options: RunOptions) -> ProcessResult

Run a command with Tea-native options.

pub def run_bytes_with(command: String, args: List[String], options: RunBytesOptions) -> ProcessBytesResult

Run a command with Tea-native byte-oriented options.

pub def run_with_options(command: String, args: List[String], env: Dict[String, String], cwd: String, stdin: String) -> ProcessResult

Run a command with full options (env, cwd, stdin).

pub def run_bytes_with_options(command: String, args: List[String], env: Dict[String, String], cwd: String, stdin: List[Int]) -> ProcessBytesResult

Run a command with full byte-oriented options (env, cwd, stdin bytes).

pub def spawn(command: String, args: List[String]) -> Int

Start a command without waiting for it to complete.

pub def spawn_with(command: String, args: List[String], options: SpawnOptions) -> Int

Spawn a command with Tea-native options.

pub def spawn_with_options(command: String, args: List[String], env: Dict[String, String], cwd: String) -> Int

Spawn a command with full options (env, cwd).

pub def wait(handle: Int) -> ProcessResult

Wait for a spawned process to complete and return its result.

pub def kill(handle: Int) -> Bool

Terminate a spawned process.

pub def read_stdout(handle: Int) -> String

Read data from a spawned process's stdout.

pub def read_stdout_bytes(handle: Int, bytes: Int) -> List[Int]

Read up to the specified number of bytes from a spawned process's stdout.

pub def read_stderr(handle: Int) -> String

Read data from a spawned process's stderr.

pub def read_stderr_bytes(handle: Int, bytes: Int) -> List[Int]

Read up to the specified number of bytes from a spawned process's stderr.

pub def write_stdin(handle: Int, data: String) -> Void

Write data to a spawned process's stdin.

pub def write_stdin_bytes(handle: Int, data: List[Int]) -> Void

Write raw bytes to a spawned process's stdin.

pub def close_stdin(handle: Int) -> Void

Close a spawned process's stdin pipe.

pub def close(handle: Int) -> Void

Close a spawned process handle without waiting for it.

pub def check(result: ProcessResult) -> ProcessResult

Require a process result to have exited successfully.

pub def check_bytes(result: ProcessBytesResult) -> ProcessBytesResult

Require a byte-oriented process result to have exited successfully.

pub def require(result: ProcessResult) -> ProcessResult ! ProcessError.CommandFailed

Require a process result to have exited successfully with a typed error.

pub def run_checked(command: String, args: List[String]) -> ProcessResult

Run a command and fail when it exits with a non-zero status.

pub def run_bytes_checked(command: String, args: List[String]) -> ProcessBytesResult

Run a command as bytes and fail when it exits with a non-zero status.

pub def run_checked_with(command: String, args: List[String], options: RunOptions) -> ProcessResult

Run a command with Tea-native options and fail when it exits non-zero.

pub def run_bytes_checked_with(command: String, args: List[String], options: RunBytesOptions) -> ProcessBytesResult

Run a command with Tea-native byte-oriented options and fail when it exits non-zero.

pub def run_checked_with_options(command: String, args: List[String], env: Dict[String, String], cwd: String, stdin: String) -> ProcessResult

Run a command with full options and fail when it exits with a non-zero status.

pub def run_bytes_checked_with_options(command: String, args: List[String], env: Dict[String, String], cwd: String, stdin: List[Int]) -> ProcessBytesResult

Run a command with full byte-oriented options and fail on non-zero exit.

pub def run_required(command: String, args: List[String]) -> ProcessResult ! ProcessError.CommandFailed

Run a command and return a typed error when it exits non-zero.

pub def run_required_with(command: String, args: List[String], options: RunOptions) -> ProcessResult ! ProcessError.CommandFailed

Run a command with Tea-native options and return a typed error on failure.

pub def stdout_lines(result: ProcessResult) -> List[String]

Split captured stdout into lines.

pub def stderr_lines(result: ProcessResult) -> List[String]

Split captured stderr into lines.