Add pre_sudo option (#219)

* Add `pre_sudo` option
This commit is contained in:
Rebecca Turner
2022-11-24 14:15:43 -05:00
committed by GitHub
parent f2c7e4848e
commit e456155562
6 changed files with 54 additions and 9 deletions

View File

@@ -30,6 +30,7 @@ mod self_renamer;
#[cfg(feature = "self-update")]
mod self_update;
mod steps;
mod sudo;
mod terminal;
mod utils;
@@ -82,7 +83,7 @@ fn run() -> Result<()> {
let git = git::Git::new();
let mut git_repos = git::Repositories::new(&git);
let sudo = utils::sudo();
let sudo = sudo::path();
let run_type = executor::RunType::new(config.dry_run());
let ctx = execution_context::ExecutionContext::new(run_type, &sudo, &git, &config, &base_dirs);
@@ -119,6 +120,10 @@ fn run() -> Result<()> {
}
}
if config.pre_sudo() {
sudo::elevate(&ctx, sudo.as_ref())?;
}
let powershell = powershell::Powershell::new();
let should_run_powershell = powershell.profile().is_some() && config.should_run(Step::Powershell);