Atom

os module

Read program arguments and environment variables or interact with the OS.

Import it with 'use os'.

Run the example without command-line arguments to get the output shown.

Atom
use os
print(count(os.args))
Output
0

Requires libuv. os.args is the program argument array. os.platform is linux, windows, macos or unknown. os.arch is x86_64, arm64 or unknown. These module fields are read-only bindings. Process functions are registered only when the host enables process controls.

Atom
use os
print(os.platform, os.arch, count(os.args))

For exec and spawn, the options dictionary accepts cwd (text, default inherited), env (dictionary of text names and text values, default inherited, supplied entries replace the child environment), input (text or packed bytes copied to stdin, default empty), timeout (finite nonnegative seconds or null, default unlimited), binary (boolean, default false), and max_output (nonnegative signed byte cap, default 64 MiB combined across stdout and stderr). Arguments pass directly to the child executable. A successful wait returns {code, signal, stdout, stderr}. Output defaults to UTF-8 strings. Binary mode returns packed bytes. Nonzero child exit is returned in the result. Close a spawned handle after use when it remains open.

Constants

args, platform, arch. See the constant index for details.

Functions