remove_var
fn remove_var(string name) -> Result<unit, EnvError> Import
Source: use env::{remove_var}; compiler/src/builtin_docs/env.hy Removes the environment variable name from this process.
Removing a variable that is not set is not an error. Needs --allow-env.
Parameters#
| Name | Type |
|---|---|
name | string |
Returns#
Result<unit, EnvError>
Examples#
use env::{set_var, remove_var, var, EnvError};
use tests::assert;
let _ = set_var("COIL_DOC_TMP", "1");
let _ = remove_var("COIL_DOC_TMP");
let gone = match var("COIL_DOC_TMP") {
Result::Err(EnvError::NotFound) => true,
default => false,
};
assert!(gone);
See also#
args: Returns the program’s command-line arguments, starting with the program name.var: Returns the value of the environment variablename.set_var: Sets the environment variablenametovaluefor 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 statuscode.exec: Runsprogramwith the argumentsargvand waits for it to finish.