build_update_command_for_executor

Function build_update_command_for_executor 

Source
pub fn build_update_command_for_executor(
    commands: &[String],
    password: Option<&str>,
    dry_run: bool,
) -> String
Expand description

What: Build system update command string by chaining multiple commands.

Inputs:

  • commands: List of commands to execute in sequence.
  • password: Optional sudo password for commands that need sudo.
  • dry_run: Whether to run in dry-run mode.

Output:

  • Command string ready for PTY execution (commands chained with &&).

Details:

  • Chains commands with && so execution stops on first failure.
  • For commands starting with sudo, pipes password if provided.
  • In dry-run mode, wraps each command in echo DRY RUN:.
  • Removes hold tail since we’re not spawning a terminal.