allow pkexec to be used instead of sudo (#201)
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
This commit is contained in:
committed by
Roey Darwish Dror
parent
f5c2368a4d
commit
fda52486b3
@@ -89,7 +89,7 @@ fn run() -> Result<(), Error> {
|
||||
let mut report = Report::new();
|
||||
|
||||
#[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "linux"))]
|
||||
let sudo = utils::which("sudo");
|
||||
let sudo = utils::sudo();
|
||||
let run_type = executor::RunType::new(config.dry_run());
|
||||
|
||||
#[cfg(feature = "self-update")]
|
||||
|
||||
@@ -80,6 +80,11 @@ pub fn which<T: AsRef<OsStr> + Debug>(binary_name: T) -> Option<PathBuf> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "linux"))]
|
||||
pub fn sudo() -> Option<PathBuf> {
|
||||
which("sudo").or_else(|| which("pkexec"))
|
||||
}
|
||||
|
||||
/// `std::fmt::Display` implementation for `std::path::Path`.
|
||||
///
|
||||
/// This struct differs from `std::path::Display` in that in Windows it takes care of printing backslashes
|
||||
|
||||
Reference in New Issue
Block a user