Module process

process

Process information, command-line arguments, environment variables, and platform detection.

Functions

raw_args function
fn() -> [*(u8)]

Get raw command-line arguments as a slice of C strings. The first element is the program name.

Returns: [*(u8)]

argc function
fn() -> i32

Get the number of command-line arguments (including program name).

Returns: i32

argv function
fn() -> *(*(u8))

Get the raw argv pointer (*(*(u8))).

Returns: *(*(u8))

args function
fn() -> ArrayList(String)

Get command-line arguments as an ArrayList(String). The first element is the program name.

Returns: ArrayList(String)

cwd function
fn() -> Result(Path, String)

Get the current working directory as a Path. Returns Err with a message on failure.

Returns: Result(Path, String)

chdir function
fn(path : Path) -> Result(unit, String)

Change the current working directory to path. Returns Ok(()) on success, or Err with a message on failure.

Parameters

NameTypeNotes
pathPath

Returns: Result(unit, String)

exit function
fn(code : usize) -> unit

Exit the process with the given status code.

Parameters

NameTypeNotes
codeusize

Returns: unit

Constants

platform constant comptime_string

Current target platform as a compile-time string. One of: "linux", "macos", "windows", "freebsd", "emscripten", "wasi".

Value: "linux"

Platform constant struct(Linux: comptime_string, Macos: comptime_string, Windows: comptime_string, FreeBSD: comptime_string, Emscripten: comptime_string, Wasi: comptime_string)

Platform constants for compile-time platform comparisons.

Value: _(Linux: "linux", Macos: "macos", Windows: "windows", FreeBSD: "freebsd", Emscripten: "emscripten", Wasi: "wasi")

arch constant comptime_string

Current target architecture as a compile-time string. One of: "x86_64", "aarch64", "x86", "arm", "wasm32".

Value: "x86_64"

Arch constant struct(X86_64: comptime_string, Aarch64: comptime_string, X86: comptime_string, Arm: comptime_string, Wasm32: comptime_string)

Architecture constants for compile-time architecture comparisons.

Value: _(X86_64: "x86_64", Aarch64: "aarch64", X86: "x86", Arm: "arm", Wasm32: "wasm32")

env constant env

Environment variable access and manipulation.

Value: env(get: <fn get>, set: <fn set>)