fix(sudo): set sudo flags depending on kind

This commit is contained in:
Andre Toerien
2025-06-25 19:46:49 +02:00
committed by Gideon
parent 32197f79f3
commit 012a6bbde3
4 changed files with 187 additions and 14 deletions

View File

@@ -11,7 +11,7 @@ use crate::executor::DryCommand;
use crate::powershell::Powershell;
#[cfg(target_os = "linux")]
use crate::steps::linux::Distribution;
use crate::sudo::Sudo;
use crate::sudo::{Sudo, SudoExecuteOpts};
use crate::utils::{get_require_sudo_string, require_option};
use crate::{config::Config, executor::Executor};
@@ -91,7 +91,14 @@ impl<'a> ExecutionContext<'a> {
/// using sudo to elevate privileges.
pub fn execute_elevated(&self, command: &Path, interactive: bool) -> Result<Executor> {
let sudo = require_option(self.sudo.as_ref(), get_require_sudo_string())?;
Ok(sudo.execute_elevated(self, command, interactive))
sudo.execute_opts(
self,
command,
SudoExecuteOpts {
interactive,
..Default::default()
},
)
}
pub fn run_type(&self) -> RunType {