System¶
Import: import system;
Read the usage guide for examples and common tasks. This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation.
print¶
Writes and flushes a value as console text, as a shortcut for System.stdout.
println¶
Writes and flushes a value followed by a newline, as a shortcut for System.stdout.
read_line¶
Reads a line of input from stdin.
read_key¶
Reads a single keypress from stdin.
exit¶
Terminates the process with the given exit code.
platform¶
The current host platform.
os_family¶
The OS family on native hosts (Unknown elsewhere).
cpu_time_nanos¶
User+system CPU time of this process since it started, in nanoseconds (0 if unknown).
memory_bytes¶
Resident process memory in bytes (0 if unknown). Not Debug.live_objects.
exe_path¶
Absolute path of the running executable when known.
env¶
Value of environment variable name, or None when unset.
set_env¶
Sets environment variable name to value.
unset_env¶
Unsets environment variable name.
env_keys¶
Names of all environment variables (empty on hosts without an env block).
temp_dir¶
Process temp directory (TMPDIR / GetTempPath / "/tmp" in the browser).
home_dir¶
User home directory when the host provides one.
cwd¶
Current working directory.
set_cwd¶
Sets the current working directory.
clear¶
Clears the terminal screen.
set_foreground¶
Sets the foreground color for subsequent output.
set_background¶
Sets the background color for subsequent output.
reset_color¶
Resets console colors to the terminal default.