| 249 | |
| 250 | impl HomeGuard { |
| 251 | fn new() -> Self { |
| 252 | let tmp = tempfile::tempdir().unwrap(); |
| 253 | let original = std::env::var_os("ATOMIC_CONFIG_DIR"); |
| 254 | // SAFETY: env mutation is technically UB under concurrent access. |
| 255 | // `#[file_serial]` serializes these tests, and no other test reads |
| 256 | // ATOMIC_CONFIG_DIR outside its own `#[file_serial]` block. |
| 257 | unsafe { |
| 258 | std::env::set_var("ATOMIC_CONFIG_DIR", tmp.path()); |
| 259 | } |
| 260 | Self { |
| 261 | _tmp: tmp, |
| 262 | original, |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | impl Drop for HomeGuard { |