Expand description
Explicit caller-owned foreground command execution. The mechanism for reading declared environment variables (#1101).
This is how a variable is read – the kinds, the owner, the typed
accessors and the boolean parsers – with no variable names in it. It lives
here, below running-process, so every crate in the workspace can share
one parser instead of growing its own; running_process::env_vars
re-exports it and keeps the policy: which variables exist, and what each
means.
§Why booleans get two accessors rather than one
“Is this switch on?” has two defensible answers when the value is neither clearly on nor clearly off, and which one is right depends on who owns the variable – not on the call site, which is how a codebase ends up with five parsers that disagree.
flag_ownedis for switches the reader defines. Unknown means off.flag_foreignis for values written by someone else. Unknown means on, so a stray=0cannot exempt a process from being reaped.flag_opt_outis for an escape hatch that is on until someone turns it off. Unset means on.
All three trim and lowercase before comparing, so " True " and "TRUE"
agree.
Structs§
- EnvVar
- One environment variable the reader reads.
Enums§
- EnvKind
- What kind of value a variable carries, and how it is read.
- Owner
- Who decides what values a variable may take.
Functions§
- flag_
foreign - Read a switch someone else writes: off only for a recognised negative.
- flag_
opt_ out - Read an escape hatch that is on unless turned off.
- flag_
owned - Read a switch the reader owns: on only for a recognised affirmative.
- os_
named - Read a variable whose name is caller-supplied data, exactly as the host wrote it.
- string_
named os_namedas Unicode:Nonewhen unset or not valid Unicode, matchingstd::env::var.- value_
is_ affirmative_ foreign - Whether a value already in hand reads as a foreign switch being on.