| 274 | |
| 275 | impl HomeGuard { |
| 276 | fn new() -> Self { |
| 277 | let tmp = tempfile::tempdir().unwrap(); |
| 278 | let original = std::env::var_os("ATOMIC_CONFIG_DIR"); |
| 279 | // SAFETY: env mutation is technically UB under concurrent access. |
| 280 | // `#[file_serial]` serializes these tests, and no other test reads |
| 281 | // ATOMIC_CONFIG_DIR outside its own `#[file_serial]` block. |
| 282 | unsafe { |
| 283 | std::env::set_var("ATOMIC_CONFIG_DIR", tmp.path()); |
| 284 | } |
| 285 | Self { |
| 286 | _tmp: tmp, |
| 287 | original, |
| 288 | } |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | impl Drop for HomeGuard { |