edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! Environment switches the engine reads, with a process-local override layer. |
| 2 | //! |
| 3 | //! Editing the real environment is `unsafe` in Rust 2024, so the tests that pin a |
| 4 | //! switch (`VE_SW`, `VE_HW_TEST_ABORT`, ...) record it here instead. Engine code |
| 5 | //! reads these keys through [`var`] / [`var_os`], which answer from the overrides |
| 6 | //! first and fall back to the real environment. A helper process the engine |
| 7 | //! starts gets the overrides through [`apply`], because it reads its own |
| 8 | //! environment and not ours. |
| 9 | |
| 10 | use BTreeMap; |
| 11 | use ; |
| 12 | use Command; |
| 13 | use RwLock; |
| 14 | |
| 15 | /// `None` as a value means "unset": the key behaves as if it were absent, even |
| 16 | /// when the real environment has it. |
| 17 | static OVERRIDES: = new; |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | /// The value of `key`: the override if one is recorded, else the real environment. |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | /// [`var_os`] as text; `None` when the value is absent or not valid Unicode. |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | /// Records `key = value` for every engine read from here on. |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | /// Records `key` as absent for every engine read from here on. |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | /// Passes every recorded override on to a helper process that is about to start, |
| 55 | /// so the helper sees the same switches as this process. |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 |