Skip to content

Commit

Permalink
systemd: avoid using unwrap
Browse files Browse the repository at this point in the history
Co-authored-by: Ramses <[email protected]>
  • Loading branch information
phanirithvij and r-vdp authored Nov 8, 2024
1 parent 79cd7d9 commit eb602df
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/activate/tmp_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ pub fn activate(etc_tree: &FileTree) -> TmpFilesActivationResult {
let conf_files = etc_tree
.nested
.get("etc")
.unwrap()
.nested
.get("tmpfiles.d")
.unwrap()
.nested
.iter()
.map(|(_, node)| node.path.to_string_lossy().to_string())
.collect::<Vec<_>>();
.and_then(|etc| etc.nested.get("tmpfiles.d"))
.map_or(vec![], |tmpfiles_d| {
tmpfiles_d
.nested
.iter()
.map(|(_, node)| node.path.to_string_lossy().to_string())
.collect::<Vec<_>>()
});
let mut cmd = process::Command::new("systemd-tmpfiles");
cmd.arg("--create").arg("--remove").args(conf_files);
log::debug!("running {:#?}", cmd);
Expand Down

0 comments on commit eb602df

Please sign in to comment.