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> {
if let Some(sudo) = sudo {
println!();
Command::new("/usr/sbin/pkg").args(&["audit", "-Fr"]).spawn()?.wait()?;
Command::new(sudo)
.args(&["/usr/sbin/pkg", "audit", "-Fr"])
.spawn()?
.wait()?;
}
Ok(())
}

View File

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