(runtime_root: &Path)
| 1856 | } |
| 1857 | |
| 1858 | fn reset_runtime_cache_mutable_state(runtime_root: &Path) -> Result<()> { |
| 1859 | for relative in ["base", "tmp", "dev/shm"] { |
| 1860 | let path = runtime_root.join(relative); |
| 1861 | match fs::remove_dir_all(&path) { |
| 1862 | Ok(()) => {} |
| 1863 | Err(err) if err.kind() == std::io::ErrorKind::NotFound => {} |
| 1864 | Err(err) => { |
| 1865 | return Err(err).with_context(|| { |
| 1866 | format!("remove mutable runtime-cache state {}", path.display()) |
| 1867 | }); |
| 1868 | } |
| 1869 | } |
| 1870 | } |
| 1871 | fs::create_dir_all(runtime_root.join("tmp")) |
| 1872 | .with_context(|| format!("create runtime cache tmp under {}", runtime_root.display()))?; |
| 1873 | fs::create_dir_all(runtime_root.join("dev/shm")).with_context(|| { |
| 1874 | format!( |
| 1875 | "create runtime cache shared-memory dir under {}", |
| 1876 | runtime_root.display() |
| 1877 | ) |
| 1878 | })?; |
| 1879 | ensure_runtime_password_file(runtime_root)?; |
| 1880 | Ok(()) |
| 1881 | } |
| 1882 | |
| 1883 | fn ensure_runtime_password_file(runtime_root: &Path) -> Result<()> { |
| 1884 | let path = runtime_root.join("password"); |
no test coverage detected