env
args and cwd need no grant. Reading or changing variables and set_cwd
need --allow-env, exec needs --allow-exec and exit needs
--allow-exit; see Permissions. exec runs a
program with an argument vector, without a shell, in the current working
directory and environment.
Built into the compiler.
Import what you use (use path::* is not allowed):
use env::{EnvError, args};
Types#
| Name | Description |
|---|---|
EnvError | The error of every fallible env function. |
Functions#
| Name | Description |
|---|---|
args | Returns the program’s command-line arguments, starting with the program name. |
var | Returns the value of the environment variable name. |
set_var | Sets the environment variable name to value for this process. |
remove_var | Removes the environment variable name from this process. |
cwd | Returns the current working directory as an absolute path. |
set_cwd | Changes the current working directory of the whole process. |
exit | Ends the process at once with exit status code. |
exec | Runs program with the arguments argv and waits for it to finish. |