Skip to main content

build_install_command_for_executor

Function build_install_command_for_executor 

Source
pub fn build_install_command_for_executor(
    items: &[PackageItem],
    password: Option<&str>,
    dry_run: bool,
) -> Result<String, String>
Expand description

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

Inputs:

  • items: Packages to install.
  • _password: Optional sudo password (unused - password is written to PTY stdin when sudo prompts).
  • dry_run: Whether to run in dry-run mode.

Output:

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

Details:

  • Groups official and AUR packages separately; mixed installs run pacman then paru/yay with --aur on AUR-only names.
  • Uses --noconfirm for non-interactive execution.
  • Always uses sudo -S for official packages (password written to PTY stdin when sudo prompts).
  • Removes hold tail since we’re not spawning a terminal.

§Errors

Returns Err when the configured privilege tool cannot be resolved for official package paths.