std / os

os

import "std:os"

Provides operating system functionality using C89 standard library functions.

View source on Codeberg →

Functions

#
func Getenv(key string) string

Retrieves the value of the environment variable named by the key. Returns an empty string if the variable is not set.

#
func System(cmd string) int

Executes a shell command and returns the exit status.

#
func Remove(path string) bool

Deletes a file at the given path. Returns true on success, false on failure.

#
func Args() []string

Returns the command-line arguments as a string slice. The first element is the program name.

#
func Rename(oldpath, newpath string) bool

Renames a file from oldpath to newpath. Returns true on success, false on failure.

#
func Exit(code int)

Terminates the program with the given exit code.

#
func Abort()

Terminates the program abnormally.