Skip to main content

build_downgrade_command_for_executor

Function build_downgrade_command_for_executor 

Source
pub fn build_downgrade_command_for_executor(
    names: &[String],
    _password: Option<&str>,
    dry_run: bool,
) -> Result<String, String>
Expand description

What: Build downgrade command string without hold tail for PTY execution.

Inputs:

  • names: Package names to downgrade.
  • _password: Optional password (unused - downgrade runs interactively in PTY).
  • dry_run: Whether to run in dry-run mode.

Output:

  • Command string ready for PTY execution (no hold tail).

Details:

  • Uses the downgrade tool to downgrade packages.
  • Checks if downgrade tool is available before executing.
  • Read-only package checks use pacman -Qi without privilege escalation.
  • Removes hold tail since we’re not spawning a terminal.

§Errors

Returns Err when the configured privilege tool cannot be resolved.