std.os
platform function
pub fn platform(): string
"windows", "linux", "macos" or "unknown".
stdlib/std/os.lyr:9
env function
pub fn env(name: string): ?string
An environment variable, or null when it is not set — an ordinary question about the
environment, not a panic.
stdlib/std/os.lyr:13
currentDir function
pub fn currentDir(): string
The current working directory.
stdlib/std/os.lyr:16
exit function
pub fn exit(code: int): void
Ends the process immediately with this code. No defer runs and no catch applies. To
exit cleanly, return from main.
stdlib/std/os.lyr:20
args function
pub fn args(): string[]
The command-line arguments, also outside main.
main(args) receives them, but a function deeper in the program does not; here they are
available without threading them through.
stdlib/std/os.lyr:28
setEnv function
pub fn setEnv(name: string, value: string): bool
Sets an environment variable for this process. Child processes inherit it; the system does not.
stdlib/std/os.lyr:32
hostName function
pub fn hostName(): ?string
The machine's name, or null when the system does not say.
stdlib/std/os.lyr:35
userName function
pub fn userName(): ?string
The current user's name, or null when the system does not say.
stdlib/std/os.lyr:37
homeDir function
pub fn homeDir(): ?string
The user's home directory, or null when the system does not say.
stdlib/std/os.lyr:39
cpuCount function
pub fn cpuCount(): int
How many cores the machine has, for programs that split their work. The VM itself is single-threaded.
stdlib/std/os.lyr:43
nowMillis function
pub fn nowMillis(): int
Milliseconds since 1970-01-01 UTC.
A number rather than a date type: dates, time zones and calendars are their own module. The number is the same on every platform.
stdlib/std/os.lyr:49
nowNanos function
pub fn nowNanos(): int
Nanoseconds from a monotonic clock. Not comparable with nowMillis; the origin is arbitrary.
A system clock can jump during a measurement, a monotonic one cannot.
stdlib/std/os.lyr:53
sleep function
pub fn sleep(millis: int): void
Suspends the process. The VM is single-threaded, so nothing runs alongside.
stdlib/std/os.lyr:56
envOr function
pub fn envOr(name: string, fallback: string): string
An environment variable with a default.
stdlib/std/os.lyr:61