os
module methods:
- stdin
- stdout
- stderr
- platform
- arch
- exit
- get_env
- get_env_ex
- set_env
- unset_env
- clear_env
- environ
- user_home_dir
- user_config_dir
- user_cache_dir
- hostname
- uid
- gid
- euid
- egid
- groups
- start_process
- find_process
stdin
open File pointing to the standard input file descriptor.
(os stdin) -> file
stdout
open File pointing to the standard output file descriptor.
(os stdout) -> file
stderr
open File pointing to the standard error file descriptor.
(os stderr) -> file
platform
it is runtime.GOOS
in Golang.
(os platform) -> string
arch
it is runtime.GOARCH
in Golang.
(os arch) -> string
exit
exit causes the current program to exit with the given status code. Conventionally,
code zero indicates success, non-zero an error. The program terminates immediately,
finally
sub-expression in try
will not execute.
(os exit code(int)) -> nil
get_env
Return the value of the environment variable named by the key
. It returns the value,
which will be empty if the variable is not present.
(os get_env key(string)) -> string
get_env_ex
Return a 2-element list value of the environment variable named by the key
and bool
value which indicate whether the key
exists.
(os get_env_ex key(string)) -> [string,bool]
set_env
Sets the value of the environment variable named by the key
. It returns an error
, if any.
(os set_env key(string) val(string)) -> nil
unset_env
Unsets a single environment variable. It returns an error
, if any.
(os unset_env key(string)) -> nil
clear_env
Deletes all environment variables.
(os clear_env) -> nil
environ
Returns a dict of strings representing the environment.
(os environ) -> dict
user_home_dir
Returns the current user's home directory. It returns an error
, if any.
(os user_home_dir) -> string
user_config_dir
Returns the default root directory to use for user-specific
configuration data. Users should create their own application-specific
subdirectory within this one and use that. It returns an error
, if any.
(os user_config_dir) -> string
user_cache_dir
Returns the default root directory to use for user-specific cached data.
Users should create their own application-specific subdirectory within
this one and use that. It returns an error
, if any.
(os user_cache_dir) -> string
hostname
Returns the host name reported by the kernel. It returns an error
, if any.
(os hostname) -> string
uid
Returns the numeric user id of the caller.
(os uid) -> int
gid
Returns the numeric group id of the caller.
(os gid) -> int
euid
Returns the numeric effective user id of the caller.
(os euid) -> int
egid
Returns the numeric effective group id of the caller.
(os egid) -> int
groups
Returns a list of the numeric ids of groups that the caller belongs to.
It returns an error
, if any.
(os groups) -> [int...]
start_process
Starts a new process with the program, arguments and attributes specified by name, args.
(os start_process name(string) args(any)...) -> process
find_process
Looks for a running process by its pid
.
(os find_process pid(int)) -> process