systemd: avoid using unwrap
Co-authored-by: Ramses <ramses@well-founded.dev>
This commit is contained in:
parent
79cd7d93e6
commit
eb602df12b
1 changed files with 8 additions and 8 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue