Skip to main content

installer_script

Function installer_script 

Source
fn installer_script(
    installer: &Path,
    sha256: &str,
    own_dir: &Path,
    failed_marker: &Path,
) -> String
Expand description

The hidden PowerShell that upgrades a setup.exe install: wait a few seconds for this launcher to be gone (its files are replaced), run the installer silently, then start AgentMux again whatever the installer did, so a failed or declined install leaves the old version running, not none.

The installer sits in the user’s own data folder, which any process of theirs can write, and on an all-users install Windows runs it elevated. So the script opens it allowing others only to read, which blocks any write, rename or delete; hashes it through that handle; and runs it only if it is sha256, holding the handle until the installer exits. The file that runs is the file that was checked.

An install that did not succeed (the installer’s exit code was not 0, or it was not the file that was checked) leaves failed_marker before AgentMux starts again, so the “Updating to ” window can say so (crate::updating_window). Writing it is best effort and changes nothing else.