Use sudo for package auditing

This commit is contained in:
Roey Darwish Dror
2018-11-15 15:54:24 +02:00
parent 846772c609
commit 92286853d1
2 changed files with 9 additions and 4 deletions

View File

@@ -51,8 +51,13 @@ pub fn upgrade_packages(
} }
} }
pub fn audit_packages() -> Result<(), failure::Error> { pub fn audit_packages(sudo: &Option<PathBuf>) -> Result<(), failure::Error> {
println!(); if let Some(sudo) = sudo {
Command::new("/usr/sbin/pkg").args(&["audit", "-Fr"]).spawn()?.wait()?; println!();
Command::new(sudo)
.args(&["/usr/sbin/pkg", "audit", "-Fr"])
.spawn()?
.wait()?;
}
Ok(()) Ok(())
} }

View File

@@ -458,7 +458,7 @@ fn run() -> Result<(), Error> {
} }
#[cfg(target_os = "freebsd")] #[cfg(target_os = "freebsd")]
freebsd::audit_packages().ok(); freebsd::audit_packages(&sudo).ok();
} }
if report.data().iter().all(|(_, succeeded)| *succeeded) { if report.data().iter().all(|(_, succeeded)| *succeeded) {