Skip to content

os

OS / arch detection, environment variables, and process info.

Constants

arch

os::arch

Target architecture (e.g. "x86_64", "aarch64", "arm").

dll_extension

os::dll_extension

Dynamic-library extension without the leading dot ("so", "dylib", "dll").

exe_extension

os::exe_extension

Executable extension without the leading dot ("" on Unix, "exe" on Windows).

family

os::family

OS family — "unix" or "windows".

name

os::name

Target OS as reported by std::env::consts::OS (e.g. "linux", "macos", "windows").

pointer_width

os::pointer_width

Pointer width in bits (32 or 64).

Functions

args

os::args() -> list<string>

Script-level arguments (host-injected via Engine::set_args; default []).

cwd

os::cwd() -> string

Current working directory.

env_var

os::env_var(name [, default]) -> string

Read an env var. Errors if missing; the optional 2nd arg is returned instead.

env_vars

os::env_vars() -> dict

Snapshot of all env vars as a dict<string, string>.

has_env_var

os::has_env_var(name) -> bool

True if the named env var is set in the current process.

pid

os::pid() -> int

Current process id.

temp_dir

os::temp_dir() -> string

Platform temporary directory.

Documentation reflects Ion v0.2.0-66-g3faa376.