diff --git a/src/main.rs b/src/main.rs index 4f75cd9f..66329ef3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -158,7 +158,7 @@ fn run() -> Result<(), Error> { execute( &mut report, "FreeBSD Packages", - || freebsd::upgrade_packages(&sudo, run_type), + || freebsd::upgrade_packages(sudo.as_ref(), run_type), config.no_retry(), )?; #[cfg(unix)] @@ -410,7 +410,7 @@ fn run() -> Result<(), Error> { execute( &mut report, "FreeBSD Upgrade", - || freebsd::upgrade_freebsd(&sudo, run_type), + || freebsd::upgrade_freebsd(sudo.as_ref(), run_type), config.no_retry(), )?; } diff --git a/src/steps/os/freebsd.rs b/src/steps/os/freebsd.rs index 9f390c17..1aed91b6 100644 --- a/src/steps/os/freebsd.rs +++ b/src/steps/os/freebsd.rs @@ -1,11 +1,12 @@ use crate::error::{Error, ErrorKind}; use crate::executor::RunType; -use crate::terminal::{print_separator, print_warning}; +use crate::terminal::print_separator; +use crate::utils::require_option; use failure::ResultExt; use std::path::PathBuf; use std::process::Command; -pub fn upgrade_freebsd(sudo: &Option, run_type: RunType) -> Result<(), Error> { +pub fn upgrade_freebsd(sudo: Option<&PathBuf>, run_type: RunType) -> Result<(), Error> { let sudo = require_option(sudo)?; print_separator("FreeBSD Update"); run_type @@ -14,7 +15,7 @@ pub fn upgrade_freebsd(sudo: &Option, run_type: RunType) -> Result<(), .check_run() } -pub fn upgrade_packages(sudo: &Option, run_type: RunType) -> Result<(), Error> { +pub fn upgrade_packages(sudo: Option<&PathBuf>, run_type: RunType) -> Result<(), Error> { let sudo = require_option(sudo)?; print_separator("FreeBSD Packages"); run_type.execute(sudo).args(&["/usr/sbin/pkg", "upgrade"]).check_run()