Skip to main content

process

include "process";

Run other programs, read the program's command-line arguments and environment variables, and resolve and inspect paths.

Types​

process​

Native object

Functions​

environment_get​

fn environment_get(string name) -> string

The environment variable name as UTF-8, or "" when it is unset. Values over 128 KiB are rejected.

process_spawn​

fn process_spawn(
array<string> arguments,
string cwd,
array<string> environment) -> process

Starts arguments[0] with the remaining arguments (no shell) in cwd. Each environment entry is NAME=value to set or a bare NAME to remove.

process_read_stdout​

fn process_read_stdout(process process, buffer data) -> int

Reads the child's available stdout bytes into data without waiting.

process_read_stderr​

fn process_read_stderr(process process, buffer data) -> int

Reads the child's available stderr bytes into data without waiting.

process_write_stdin​

fn process_write_stdin(process process, buffer data) -> int

Writes data to the child's stdin; returns the bytes accepted.

process_close_stdin​

fn process_close_stdin(process process)

Closes the child's stdin.

process_poll​

fn process_poll(process process) -> int

-2 while running, the exit status when finished, -1 after close.

process_close​

fn process_close(process process)

Releases the child's handles and terminates its process group or job.

path_resolve_into​

fn path_resolve_into(string path, buffer output) -> int

Writes the absolute form of path into output; returns the byte count.

path_kind​

fn path_kind(string path) -> int

0 missing, 1 file, 2 directory, 5 executable file.

platform_windows​

fn platform_windows() -> bool

Whether the program runs on Windows.