os

native module

Process, environment, and subprocess access. import "os".

os.args() => [string]

Process command-line arguments.

os.exit(code: int)

Terminate the process with code (does not return).

os.getenv(key: string) => string

Value of env var key, or "" if unset.

os.setenv(key: string, value: string) => string?

Set an env var. Void action: err is nil on success, a message on failure.

os.cwd() => string

Current working directory.

os.platform() => string

"windows", "linux", "macos", or "unknown".

os.clock() => float

Wall-clock time as fractional Unix seconds.

os.exec(command: [string]) => (map, string?)

Run a subprocess ({exe, arg1, …}); on success returns {"stdout", "stderr", "code"}. Err set only if the process couldn't launch.

On this page